66 version :
77 description : ' Version to release (e.g., 1.0.1)'
88 required : true
9- default : ' 1.0.0'
109
1110jobs :
12- build :
11+ prep-and-release :
1312 runs-on : ubuntu-latest
1413 permissions :
1514 contents : write
16- packages : write
15+ outputs :
16+ version : ${{ github.event.inputs.version }}
1717 steps :
1818 - uses : actions/checkout@v6
1919 with :
2323 uses : actions/setup-node@v6
2424 with :
2525 node-version : ' 20'
26- registry-url : ' https://registry.npmjs.org'
2726
2827 - name : Install dependencies
2928 run : npm install
@@ -41,22 +40,49 @@ jobs:
4140
4241 - name : Create GitHub Release
4342 uses : softprops/action-gh-release@v2
44- if : startsWith(github.ref, 'refs/heads/')
4543 with :
4644 tag_name : v${{ github.event.inputs.version }}
4745 name : Release v${{ github.event.inputs.version }}
4846 files : fontkit-dist.zip
4947 token : ${{ secrets.GITHUB_TOKEN }}
5048
51- - name : Publish to NPM
52- run : npm publish
53- env :
54- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
55-
5649 - name : Commit version bump
5750 run : |
5851 git config --global user.name "GitHub Actions"
5952 git config --global user.email "actions@github.com"
6053 git add package.json package-lock.json
6154 git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
6255 git push origin HEAD:${{ github.ref }}
56+
57+ publish :
58+ needs : prep-and-release
59+ runs-on : ubuntu-latest
60+ permissions :
61+ contents : read
62+ packages : write
63+ strategy :
64+ matrix :
65+ include :
66+ - registry : ' https://registry.npmjs.org'
67+ token_name : ' NPM_TOKEN'
68+ - registry : ' https://npm.pkg.github.com'
69+ token_name : ' GITHUB_TOKEN'
70+ steps :
71+ - uses : actions/checkout@v6
72+ - name : Setup Node
73+ uses : actions/setup-node@v6
74+ with :
75+ node-version : ' 20'
76+ registry-url : ${{ matrix.registry }}
77+ scope : ' @mkdocs'
78+
79+ - name : Install dependencies
80+ run : npm install
81+
82+ - name : Update Version
83+ run : npm version ${{ github.event.inputs.version }} --no-git-tag-version
84+
85+ - name : Publish
86+ run : npm publish
87+ env :
88+ NODE_AUTH_TOKEN : ${{ secrets[matrix.token_name] }}
0 commit comments