File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Tagging 🏷️
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+ branches : [main]
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : " Version to release (e.g., 1.2.3)"
11+ required : true
12+ type : string
13+
14+ jobs :
15+ create-tag :
16+ if : |
17+ github.event_name == 'workflow_dispatch' ||
18+ (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/'))
19+ runs-on : ubuntu-latest
20+ permissions :
21+ contents : write
22+ steps :
23+ - uses : actions/checkout@v6
24+
25+ - name : Determine version
26+ id : version
27+ run : |
28+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
29+ VERSION="${{ inputs.version }}"
30+ else
31+ VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's|^release/||')
32+ fi
33+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
34+ echo "Invalid version format: $VERSION"
35+ exit 1
36+ fi
37+ echo "version=$VERSION" >> $GITHUB_OUTPUT
38+
39+ - uses : fregante/setup-git-user@v2
40+
41+ - name : Bump version and push tag
42+ run : |
43+ npm version ${{ steps.version.outputs.version }}
44+ git push origin ${{ github.ref_name }} --tags
You can’t perform that action at this time.
0 commit comments