Skip to content

Commit

Permalink
Add Docker image tag with SHA of its commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jan 23, 2025
1 parent 037d469 commit 7b422f9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ jobs:
with:
cache-from: type=registry,ref=ghcr.io/mrlvsb/kelvin-ci-cache
cache-to: type=registry,ref=ghcr.io/mrlvsb/kelvin-ci-cache,compression=zstd
tags: ghcr.io/mrlvsb/kelvin:latest
tags: ghcr.io/mrlvsb/kelvin:latest,ghcr.io/mrlvsb/kelvin:${{ github.sha }}
outputs: type=docker,dest=${{ runner.temp }}/kelvin.tar
- name: Share built image
uses: actions/upload-artifact@v4
with:
name: kelvin
path: ${{ runner.temp }}/kelvin.tar
retention-days: 1
deploy:
runs-on: ubuntu-latest
permissions:
Expand All @@ -90,12 +91,6 @@ jobs:
steps:
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Login to Docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download built image
uses: actions/download-artifact@v4
with:
Expand All @@ -105,12 +100,15 @@ jobs:
run: |
docker load --input ${{ runner.temp }}/kelvin.tar
docker image ls -a
- name: Push Docker image
uses: docker/build-push-action@v6
- name: Login to Docker registry
uses: docker/login-action@v3
with:
push: true
tags: ghcr.io/mrlvsb/kelvin:latest
# Summary job to enable easier handling of required statust checks.
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: docker push --all-tags ghcr.io/mrlvsb/kelvin
# Summary job to enable easier handling of required status checks.
# On PRs, we need everything to be green, while deploy is skipped.
# On merge queue, we need everything to be green.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
Expand Down

0 comments on commit 7b422f9

Please sign in to comment.