Skip to content

Commit

Permalink
Fix: Add version tag extraction to workflow
Browse files Browse the repository at this point in the history
Extracts major, minor, and patch versions from git tags and sets them as environment variables. Updates the Docker build and push step to tag images using these version components, ensuring better version management.

Signed-off-by: Christian Roessner <[email protected]>
  • Loading branch information
Christian Roessner committed Sep 16, 2024
1 parent a00d64f commit 7af602e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/docker-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Extract tag versions
id: extract_version
run: |
tag=${GITHUB_REF##*/} # gets the tag name, e.g., v1.2.3
major=$(echo $tag | cut -d'.' -f1)
minor=$(echo $tag | cut -d'.' -f2)
patch=$(echo $tag | cut -d'.' -f3)
echo "major=${major}" >> $GITHUB_ENV
echo "minor=${minor}" >> $GITHUB_ENV
echo "patch=${patch}" >> $GITHUB_ENV- name: Build and push
- name: Build and push
uses: docker/build-push-action@v5
with:
Expand All @@ -33,4 +44,7 @@ jobs:
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/nauthilus:latest
ghcr.io/${{ github.repository_owner }}/nauthilus:${{ env.major }}
ghcr.io/${{ github.repository_owner }}/nauthilus:${{ env.major }}.${{ env.minor }}
ghcr.io/${{ github.repository_owner }}/nauthilus:${{ env.major }}.${{ env.minor }}.${{ env.patch }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Multi purpose authentication server

0 comments on commit 7af602e

Please sign in to comment.