Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: request #41477 Publish container image on ghcr.io #265

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ${{ env.REGISTRY }}
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
15 changes: 13 additions & 2 deletions .github/workflows/Build_Docker_Image_PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,16 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
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