Skip to content

Commit 32f39e7

Browse files
committed
Enhance release workflow to extract version from manifest and create tags on master branch
1 parent 19c9dd0 commit 32f39e7

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Release Build
22

33
on:
44
push:
5+
branches:
6+
- master
57
tags:
68
- "*"
79

@@ -12,10 +14,31 @@ jobs:
1214
steps:
1315
- name: Checkout repository
1416
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Extract version from manifest
21+
id: manifest_version
22+
run: |
23+
VERSION=$(grep -oP '"version":\s*"\K[^"]+' src/manifest_firefox.json)
24+
echo "VERSION=v$VERSION" >> $GITHUB_OUTPUT
25+
26+
- name: Create and push tag
27+
if: github.ref == 'refs/heads/master'
28+
run: |
29+
git config user.name "github-actions[bot]"
30+
git config user.email "github-actions[bot]@users.noreply.github.com"
31+
git tag ${{ steps.manifest_version.outputs.VERSION }}
32+
git push origin ${{ steps.manifest_version.outputs.VERSION }}
1533
1634
- name: Get tag version
1735
id: tag
18-
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
36+
run: |
37+
if [ "${{ github.ref_type }}" == "tag" ]; then
38+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
39+
else
40+
echo "VERSION=${{ steps.manifest_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
41+
fi
1942
2043
- name: Extract latest changelog
2144
id: changelog

0 commit comments

Comments
 (0)