Skip to content

Commit

Permalink
chore: request #41477 Publish container image on ghcr.io
Browse files Browse the repository at this point in the history
Build pipelines have been adjusted to also add attestations information.
  • Loading branch information
LeSuisse committed Feb 3, 2025
1 parent 4e44a56 commit ea12800
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/Build_And_Publish_Docker_Images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,45 @@ on:
permissions: {}

env:
IMAGE_NAME: enalean/bz2tuleap
IMAGE_NAME: Enalean/bz2tuleap
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Build image
run: docker build -t ${{ env.IMAGE_NAME }} --label revision=${{ github.sha }} --label workflow_run_id=${{ github.run_id }} .
- name: Install Cosign
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # tag=v3.7.0
- name: Log into Docker Hub
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u bz2tuleappushbot --password-stdin
- name: Publish image
run: docker push ${{ env.IMAGE_NAME }}
- name: Sign image
run: |
cosign sign --yes "$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.IMAGE_NAME }})"
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # tag=v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # tag=v5.6.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # tag=v6.13.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # tag=v2.2.0
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
13 changes: 13 additions & 0 deletions .github/workflows/Build_Docker_Image_PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ jobs:
persist-credentials: false
- name: Build image
run: docker build -t test-build .
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # tag=v5.6.1
with:
images: test-build
- name: Build and push Docker image
id: push
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # tag=v6.13.0
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ With docker:

$> docker run -ti --rm -u $(id -u):$(id -g) \
-v ~/Downloads:/source enalean/bz2tuleap \
/app/convert.sh /source/bugzilla_export.xml bugzilla
/app/convert.sh /source/bugzilla_export.xml ghcr.io/Enalean/bz2tuleap

Where:

Expand Down

0 comments on commit ea12800

Please sign in to comment.