-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated workflow to release floating tags
- Loading branch information
1 parent
84cf9bf
commit a43d4f1
Showing
1 changed file
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Publish Docker Image to GHCR | ||
name: Release new version | ||
|
||
on: | ||
release: | ||
|
@@ -37,3 +37,26 @@ jobs: | |
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
create-floating-tag: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set major version | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
current_version=${{github.event.release.tag_name}} | ||
if [[ ! "$current_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Error: current_version does not follow semantic versioning (vX.Y.Z)." | ||
exit 1 | ||
fi | ||
major_version="${version%%.*}" | ||
git tag -d "$major_version" 2>/dev/null || echo "Tag $major_version not found." | ||
git tag $major_version $current_version | ||
git push origin $major_version --force |