Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(release): v1.0.1 #4

Merged
merged 7 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading