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+ push :
5+ tags :
6+ - ' v*'
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : ' Version to release (e.g. 1.0.1)'
11+ required : true
12+ type : string
13+
14+ permissions :
15+ id-token : write
16+ contents : write
17+
18+ jobs :
19+ publish :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v7
23+ - uses : actions/setup-node@v7
24+ with :
25+ node-version : ' 24'
26+ registry-url : ' https://registry.npmjs.org'
27+ - run : npm ci
28+ - run : npm run lint
29+ - run : npm run build
30+ - run : npm test
31+ - name : Set version from workflow input (patch release)
32+ if : github.event_name == 'workflow_dispatch'
33+ run : |
34+ current=$(node -p "require('./package.json').version")
35+ if [ "$current" != "${{ inputs.version }}" ]; then
36+ npm version ${{ inputs.version }} --no-git-tag-version
37+ fi
38+ - run : npm publish --access public --provenance
39+
40+ github-release :
41+ needs : publish
42+ runs-on : ubuntu-latest
43+ steps :
44+ - uses : actions/checkout@v7
45+ - name : Determine version
46+ id : version
47+ run : |
48+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
49+ echo "tag=v${{ inputs.version }}" >> "$GITHUB_OUTPUT"
50+ else
51+ echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
52+ fi
53+ - uses : softprops/action-gh-release@v3
54+ with :
55+ tag_name : ${{ steps.version.outputs.tag }}
56+ generate_release_notes : true
You can’t perform that action at this time.
0 commit comments