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 : Cut a new tag (also auto updates package.json and package-lock.json)
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ release_type :
7+ description : ' Version bump type (patch, minor, major)'
8+ required : true
9+ default : ' patch'
10+
11+ jobs :
12+ bump-version :
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v3
18+
19+ - name : Set up Node.js
20+ uses : actions/setup-node@v3
21+ with :
22+ node-version : ' 20'
23+
24+ - name : Get triggering user's email
25+ run : |
26+ user_email=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/users/${{ github.actor }} | jq -r '.email')
27+ if [ -z "$user_email" ] || [ "$user_email" == "null" ]; then
28+ user_email="github-actions@github.com"
29+ fi
30+ echo "user_email=$user_email" >> $GITHUB_ENV
31+
32+ - name : Configure Git with the triggering user's info
33+ run : |
34+ git config user.name "${{ github.actor }}"
35+ git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
36+
37+
38+ - name : Bump version and push tag
39+ run : |
40+ npm install
41+ npm version ${{ github.event.inputs.release_type }} -m "chore: bump version to %s"
42+ git push --follow-tags
43+ env :
44+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments