Skip to content

Commit 0b84dc6

Browse files
committed
ci: tag containers on release
Signed-off-by: Felix Moessbauer <[email protected]>
1 parent 3abd3ea commit 0b84dc6

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/publish.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,46 @@ jobs:
5555
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
5656
with:
5757
packages-dir: dist/
58+
59+
deploy_containers:
60+
name: Build and deploy container images
61+
runs-on: ubuntu-24.04
62+
permissions:
63+
id-token: write
64+
packages: write
65+
contents: read
66+
attestations: write
67+
steps:
68+
- name: Check out repo
69+
uses: actions/checkout@v4
70+
- name: Get release
71+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
72+
- name: Set up docker build
73+
uses: ./.github/actions/docker-init
74+
with:
75+
deploy-user: ${{ github.actor }}
76+
deploy-token: ${{ secrets.GITHUB_TOKEN }}
77+
- name: Find latest tag
78+
run: echo "LATEST_TAG=$(git tag | sort --version-sort | tail -n1)" >> $GITHUB_ENV
79+
- name: Build image
80+
uses: docker/build-push-action@v6
81+
id: push
82+
with:
83+
context: /home/runner/debsbom-clone
84+
target: debsbom
85+
platforms: linux/amd64,linux/arm64
86+
build-args: |
87+
SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
88+
DEBIAN_TAG=${{ env.DEBIAN_TAG }}
89+
provenance: false
90+
outputs: type=registry,rewrite-timestamp=true
91+
tags: |
92+
ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}
93+
${{ github.ref_name == env.LATEST_TAG && format('ghcr.io/{0}:latest-release', github.repository) || '' }}
94+
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}
95+
- name: Attest image
96+
uses: actions/attest-build-provenance@v1
97+
with:
98+
subject-name: ghcr.io/${{ github.repository }}
99+
subject-digest: ${{ steps.push.outputs.digest }}
100+
push-to-registry: true

0 commit comments

Comments
 (0)