File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update Version and Publish
2+
3+ on :
4+ release :
5+ types : [created]
6+
7+ jobs :
8+ build-and-publish :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v3
12+ with :
13+ ref : ${{ github.event.release.target_commitish }}
14+
15+ - name : Set up Node.js
16+ uses : actions/setup-node@v3
17+ with :
18+ node-version : " 18"
19+ registry-url : " https://registry.npmjs.org"
20+
21+ - name : Install dependencies
22+ run : npm ci
23+
24+ - name : Extract version from release
25+ id : extract_version
26+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
27+
28+ - name : Update version.ts
29+ run : |
30+ echo "export const VERSION = \"$VERSION\";" > common/version.ts
31+
32+ - name : Update package.json version
33+ run : npm version $VERSION --no-git-tag-version
34+
35+ - name : Build
36+ run : npm run build
37+
38+ - name : Commit changes
39+ run : |
40+ git config --local user.email "[email protected] " 41+ git config --local user.name "GitHub Action"
42+ git add common/version.ts package.json
43+ git commit -m "chore: update version to $VERSION [skip ci]"
44+ git push
45+
46+ - name : Publish to npm
47+ run : npm publish
48+ env :
49+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments