Skip to content

Commit

Permalink
ci(release): v1.0.1 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswblake authored Dec 30, 2024
1 parent dd80906 commit fd4f2b9
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
55 changes: 55 additions & 0 deletions .github/workflows/update-release-tags.yml
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"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "javascript-action",
"description": "GitHub Actions JavaScript Template",
"version": "1.0.0",
"version": "1.0.1",
"author": "",
"private": true,
"homepage": "https://github.com/actions/javascript-action#readme",
Expand Down

0 comments on commit fd4f2b9

Please sign in to comment.