File: release.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 (57 lines) | stat: -rw-r--r-- 2,302 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
name: release

on:
  push:
    tags:
      - '*.*'

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
      - name: Get release
        run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
      - name: Set up docker build
        uses: ./.github/actions/docker-init
        with:
          deploy-user: ${{ github.actor }}
          deploy-token: ${{ secrets.GITHUB_TOKEN }}
          image-name: ${{ matrix.image-name }}
          distro-release: ${{ matrix.distro-release }}
      - name: Find latest tag
        run: echo "LATEST_TAG=$(git tag | sort --version-sort | tail -n1)" >> $GITHUB_ENV
      - name: Build ${{ matrix.image-name }} image
        uses: docker/build-push-action@v6
        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: |
            ghcr.io/${{ github.repository }}/${{ matrix.image-name }}:${{ env.RELEASE_VERSION }}-${{ matrix.distro-release }}
            ${{ matrix.distro-release == env.DISTRO_LATEST_RELEASE && format('ghcr.io/{0}/{1}:{2}', github.repository, matrix.image-name, env.RELEASE_VERSION) || '' }}
            ${{ matrix.distro-release == env.DISTRO_LATEST_RELEASE && github.ref_name == env.LATEST_TAG && format('ghcr.io/{0}/{1}:latest-release', github.repository, matrix.image-name) || '' }}
          annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}
      - name: Attest ${{ matrix.image-name }} image
        uses: actions/attest-build-provenance@v1
        with:
          subject-name: ghcr.io/${{ github.repository }}/${{ matrix.image-name }}
          subject-digest: ${{ steps.push.outputs.digest }}
          push-to-registry: true