Skip to content

Commit

Permalink
chore: Add build trigger glob pattern for version with suffix (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
k15r authored Jul 9, 2024
1 parent a0ee5a3 commit c8e07fa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
env:

jobs:
Expand All @@ -28,8 +29,6 @@ jobs:
- name: prepare envs
id: prepare-envs
run: |
# just stripping the leading `v` from the tag
SEMVER=$( echo ${{ github.ref_name }} | sed 's/^v//' )
{
# this creates a multiline string with the envs.
# Everything between `build-args<<BUILD_ARGS` and BUILD_ARGS will be content of the build-args variable.
Expand All @@ -51,14 +50,13 @@ jobs:
echo 'CURRENT_TAG=${{ github.ref_name }}' >> "$GITHUB_OUTPUT"
# join all tags with the new tag in one list. Inject our new version in the list. Sort the list and get the line prior to the new tag
PREFIX=
previous_version=$(git for-each-ref --sort=creatordate --format '%(refname)' refs/tags \
| grep -E "^refs/tags/${PREFIX}[0-9]+\.[0-9]+\.[0-9]+$" \
| grep -E "^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$" \
| grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o \
| sort -t "." -k1,1n -k2,2n -k3,3n \
| grep -B 1 ${{ github.ref_name }} | head -1)
echo "PREVIOUS_TAG=v${previous_version}" >> "$GITHUB_OUTPUT"
echo "PREVIOUS_TAG=${previous_version}" >> "$GITHUB_OUTPUT"
build-image:
needs: envs
Expand Down

0 comments on commit c8e07fa

Please sign in to comment.