Skip to content

Commit

Permalink
Add semver tags and edge tag for docker containers
Browse files Browse the repository at this point in the history
For each tag following the `vX.Y.Z` syntax that is pushed to GitHub, a
docker container with the tag `X.Y.Z` is created. In addition, the tags
`X.Y` and `X` are also created or updated. Furthermore, the `latest` tag
will point to container of the latest tag, and the `edge` tag will point
to the container corresponding to the latest commit of the `main`
branch.
  • Loading branch information
QuantumDancer committed Sep 14, 2023
1 parent 0822f48 commit f1a42c9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
uses: actions/checkout@v4

- name: Log in to Docker Hub
if: ${{ github.repository == 'ALU-Schumacher/AUDITOR' && github.ref == 'refs/heads/main' }}
if: ${{ github.repository == 'ALU-Schumacher/AUDITOR' && github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to ghcr.io
if: ${{ github.repository == 'ALU-Schumacher/AUDITOR' && github.ref == 'refs/heads/main' }}
if: ${{ github.repository == 'ALU-Schumacher/AUDITOR' && github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -50,6 +50,11 @@ jobs:
images: |
aluschumacher/${{ matrix.containers }}
ghcr.io/ALU-Schumacher/${{ matrix.containers }}
tags: |
type=edge,branch=main
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -59,7 +64,7 @@ jobs:
with:
context: .
file: containers/${{ matrix.containers }}/Dockerfile
push: ${{ github.repository == 'ALU-Schumacher/AUDITOR' && github.ref == 'refs/heads/main' }}
push: ${{ github.repository == 'ALU-Schumacher/AUDITOR' && github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down

0 comments on commit f1a42c9

Please sign in to comment.