Skip to content

Commit d5ca617

Browse files
committed
Feature: Add reusable workflow
1 parent 6c5c38e commit d5ca617

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/reusable.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Releases
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
release_tag:
7+
description: Git tag associated with the new release
8+
required: true
9+
type: string
10+
11+
jobs:
12+
update-major-version-tag:
13+
name: Update major version tag
14+
permissions:
15+
contents: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # Fetch entire Git history
22+
23+
- name: Extract major version
24+
run: |
25+
release_tag=${{ inputs.release_tag }}
26+
major_version=$(echo $release_tag | awk -F'.' '{ print $1 }')
27+
if [ ! "$major_version" =~ ^v[0-9]+$ ]; then
28+
echo "Release tag does not follow Semantic Versioning"
29+
echo "Cannot continue, exiting..."
30+
exit 1
31+
fi
32+
33+
echo "Successfully extracted major version '$major_version'"
34+
echo "major_version=$major_version" >> $GITHUB_ENV
35+
36+
- name: Update Git tag
37+
run: git tag -f ${{ env.major_version }} ${{ inputs.release_tag }}
38+
39+
- name: Push changes
40+
run: git push origin ${{ env.major_version }} --force --follow-tags

0 commit comments

Comments
 (0)