File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ description : ' Version (e.g. 11.1.1)'
8+ required : true
9+
10+ permissions :
11+ contents : write
12+
13+ jobs :
14+ release :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v6
18+ with :
19+ ref : main
20+
21+ - name : Validate version
22+ run : |
23+ if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
24+ echo "❌ Invalid version format. Use semver (e.g. 11.1.1)"
25+ exit 1
26+ fi
27+
28+ - name : Check tag does not exist
29+ run : |
30+ if git ls-remote --tags origin "refs/tags/v${{ github.event.inputs.version }}" | grep -q .; then
31+ echo "❌ Tag v${{ github.event.inputs.version }} already exists"
32+ exit 1
33+ fi
34+
35+ - name : Update style.css version
36+ run : sed -i "s/Version: .*/Version: ${{ github.event.inputs.version }}/" style.css
37+
38+ - name : Create release commit and tag
39+ run : |
40+ git config user.name "github-actions[bot]"
41+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42+ git add style.css
43+ git commit --message "🔖 v${{ github.event.inputs.version }}"
44+ git tag "v${{ github.event.inputs.version }}"
45+ git push origin "refs/tags/v${{ github.event.inputs.version }}"
You can’t perform that action at this time.
0 commit comments