Skip to content

Commit

Permalink
feat: verify tag with semver
Browse files Browse the repository at this point in the history
  • Loading branch information
Fovty committed Apr 18, 2024
1 parent 2e6f7fd commit 0a8c46e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,25 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Check Version Format in Tag
if: startsWith(github.ref, 'refs/tags/v')
uses: nowsprinting/[email protected]
id: check-version
with:
prefix: 'v'

- name: Set tag
id: set-tag
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
TAG_VERSION=$(echo ${{ github.ref }} | sed 's,refs/tags/v,,g')
if [[ "${{ github.ref }}" == "refs/tags/v*" ]]; then
echo "::set-output name=tag1::latest"
echo "::set-output name=tag2::$TAG_VERSION"
else
echo "::set-output name=tag1::dev"
echo "::set-output name=tag2::commit-$SHORT_SHA"
TAG1="dev"
TAG2="commit-$SHORT_SHA"
if [[ "${{ steps.check-version.outputs.is_valid }}" == 'true' ]]; then
TAG1="latest"
TAG2="${{ steps.check-version.outputs.full_without_prefix }}"
fi
echo "::set-output name=tag1::$TAG1"
echo "::set-output name=tag2::$TAG2"
- name: Docker meta
id: meta
Expand Down

0 comments on commit 0a8c46e

Please sign in to comment.