Skip to content

Commit fd4f2b9

Browse files
authored
ci(release): v1.0.1 (#4)
1 parent dd80906 commit fd4f2b9

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update Release Tags
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update-version-tags:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Determine version tag numbers
18+
id: extract_version_tags
19+
run: |
20+
echo "Determining major and minor tag numbers for:"
21+
echo "${{ github.sha }} ${{ github.ref }} "
22+
tag="${GITHUB_REF#refs/tags/v}"
23+
minor_version="${tag%.*}"
24+
major_version="${tag%%.*}"
25+
echo "minor_version=v$minor_version" >> "$GITHUB_OUTPUT"
26+
echo "major_version=v$major_version" >> "$GITHUB_OUTPUT"
27+
28+
- name: Create tags locally
29+
run: |
30+
git tag "${{ steps.extract_version_tags.outputs.minor_version }}" -f
31+
echo "Created minor release tag: ${{ steps.extract_version_tags.outputs.minor_version }}"
32+
git tag "${{ steps.extract_version_tags.outputs.major_version }}" -f
33+
echo "Created major release tag: ${{ steps.extract_version_tags.outputs.major_version }}"
34+
35+
- name: Check tag hashes match original sha
36+
run: |
37+
minor_sha=$(git rev-parse "${{ steps.extract_version_tags.outputs.minor_version }}")
38+
major_sha=$(git rev-parse "${{ steps.extract_version_tags.outputs.major_version }}")
39+
if [ "$minor_sha" != "${{ github.sha }}" ]; then
40+
echo "Minor tag does not match original sha"
41+
exit 1
42+
fi
43+
if [ "$major_sha" != "${{ github.sha }}" ]; then
44+
echo "Minor tag does not match original sha"
45+
exit 1
46+
fi
47+
echo "Tag hashes verified."
48+
49+
- name: Force push tags to remote
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
git push origin "${{ steps.extract_version_tags.outputs.minor_version }}" -f
54+
git push origin "${{ steps.extract_version_tags.outputs.major_version }}" -f
55+
echo "Pushed tags to origin"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "javascript-action",
33
"description": "GitHub Actions JavaScript Template",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"author": "",
66
"private": true,
77
"homepage": "https://github.com/actions/javascript-action#readme",

0 commit comments

Comments
 (0)