generated from actions/javascript-action
-
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.
- Loading branch information
1 parent
dd80906
commit fd4f2b9
Showing
2 changed files
with
56 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Update Release Tags | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update-version-tags: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine version tag numbers | ||
id: extract_version_tags | ||
run: | | ||
echo "Determining major and minor tag numbers for:" | ||
echo "${{ github.sha }} ${{ github.ref }} " | ||
tag="${GITHUB_REF#refs/tags/v}" | ||
minor_version="${tag%.*}" | ||
major_version="${tag%%.*}" | ||
echo "minor_version=v$minor_version" >> "$GITHUB_OUTPUT" | ||
echo "major_version=v$major_version" >> "$GITHUB_OUTPUT" | ||
- name: Create tags locally | ||
run: | | ||
git tag "${{ steps.extract_version_tags.outputs.minor_version }}" -f | ||
echo "Created minor release tag: ${{ steps.extract_version_tags.outputs.minor_version }}" | ||
git tag "${{ steps.extract_version_tags.outputs.major_version }}" -f | ||
echo "Created major release tag: ${{ steps.extract_version_tags.outputs.major_version }}" | ||
- name: Check tag hashes match original sha | ||
run: | | ||
minor_sha=$(git rev-parse "${{ steps.extract_version_tags.outputs.minor_version }}") | ||
major_sha=$(git rev-parse "${{ steps.extract_version_tags.outputs.major_version }}") | ||
if [ "$minor_sha" != "${{ github.sha }}" ]; then | ||
echo "Minor tag does not match original sha" | ||
exit 1 | ||
fi | ||
if [ "$major_sha" != "${{ github.sha }}" ]; then | ||
echo "Minor tag does not match original sha" | ||
exit 1 | ||
fi | ||
echo "Tag hashes verified." | ||
- name: Force push tags to remote | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git push origin "${{ steps.extract_version_tags.outputs.minor_version }}" -f | ||
git push origin "${{ steps.extract_version_tags.outputs.major_version }}" -f | ||
echo "Pushed tags to origin" |
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