File tree Expand file tree Collapse file tree 1 file changed +41
-2
lines changed
Expand file tree Collapse file tree 1 file changed +41
-2
lines changed Original file line number Diff line number Diff line change 22
33Use e.g. in a ` package.json ` or github action
44
5- ### In your package.json
5+ ### package.json
6+ You can call this script from your package.json scripts
67``` json
78{
89 "scripts" : {
@@ -12,12 +13,50 @@ Use e.g. in a `package.json` or github action
1213}
1314```
1415
15- ### Publish via github workflow
16+ ## Publish via Github Action
1617``` yml
1718 - name : Run publish command # publish a new version with a tag + git short hash
1819 run : npx . publish "path/to/directory" --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --version+hash --version+tag --tag --tag "${{ github.ref_name }}"
1920` ` `
2021
22+ ### Example
23+
24+ ` ` ` yml
25+ name : Release Workflow
26+ on :
27+ push :
28+ branches :
29+ - ' release/*'
30+
31+ jobs :
32+ run-release-script :
33+ runs-on : ubuntu-latest
34+ timeout-minutes : 10
35+ defaults :
36+ run :
37+ working-directory : .
38+ steps :
39+ - name : Checkout code
40+ uses : actions/checkout@v4
41+ with :
42+ submodules : ' recursive' # Fetch all submodules recursively
43+ token : ${{ secrets.GH_RELEASE_TOKEN }}
44+
45+ - name : Setup Node.js
46+ uses : actions/setup-node@v4
47+ with :
48+ node-version : ' 22'
49+
50+ - name : Install dependencies
51+ run : npm install
52+
53+ - name : Publish to npm
54+ run : npx --yes needle-tools/npm-publish-helper publish "./dist" --webhook "${{ secrets.DISCORD_WEBHOOK }}" --access-token "${{ secrets.NPM_TOKEN }}" --tag "${{github.ref_name}}" --version+tag --version+hash
55+
56+
57+ ```
58+
59+
2160
2261
2362# Contact ✒️
You can’t perform that action at this time.
0 commit comments