File: master.yml

package info (click to toggle)
kas 5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,268 kB
  • sloc: python: 5,745; sh: 1,095; makefile: 210
file content (65 lines) | stat: -rw-r--r-- 2,351 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: master

on:
  push:
    branches:
      - master

jobs:
  deploy_containers:
    name: Build and deploy container images
    runs-on: ubuntu-24.04
    permissions:
      id-token: write
      packages: write
      contents: read
      attestations: write
    strategy:
      matrix:
        image-name: ["kas", "kas-isar"]
        distro-release: ["debian-bookworm", "debian-trixie"]
    steps:
      - name: Check out repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Identify release build
        run: |
          # The release workflow will push :latest for tagged revisions
          if git describe --exact-match --tags --match '*.*'; then
              echo "PUSH_MASTER=false" >> $GITHUB_ENV
          else
              echo "PUSH_MASTER=true" >> $GITHUB_ENV
          fi
      - name: Set up docker build
        uses: ./.github/actions/docker-init
        if: ${{ env.PUSH_MASTER == 'true' }}
        with:
          deploy-user: ${{ github.actor }}
          deploy-token: ${{ secrets.GITHUB_TOKEN }}
          image-name: ${{ matrix.image-name }}
          distro-release: ${{ matrix.distro-release }}
      - name: Build ${{ matrix.image-name }} image
        uses: docker/build-push-action@v6
        if: ${{ env.PUSH_MASTER == 'true' }}
        id: push
        with:
          context: /home/runner/kas-clone
          target: ${{ matrix.image-name }}
          platforms: linux/amd64,linux/arm64
          build-args: |
            SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
            DEBIAN_TAG=${{ env.DEBIAN_TAG }}
          provenance: false
          outputs: type=registry,rewrite-timestamp=true
          tags: |
            ${{ matrix.distro-release == env.DISTRO_LATEST_RELEASE && format('ghcr.io/{0}/{1}:latest', github.repository, matrix.image-name) || '' }}
            ghcr.io/${{ github.repository }}/${{ matrix.image-name }}:latest-${{ matrix.distro-release }}
          annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}
      - name: Attest ${{ matrix.image-name }} image
        uses: actions/attest-build-provenance@v1
        if: ${{ env.PUSH_MASTER == 'true' }}
        with:
          subject-name: ghcr.io/${{ github.repository }}/${{ matrix.image-name }}
          subject-digest: ${{ steps.push.outputs.digest }}
          push-to-registry: true