1- name : Publish Superdoc Package to npm on Tag
1+ name : Publish SuperDoc Package to npm
22
33on :
44 push :
55 branches :
66 - main
77 paths-ignore :
8- - ' README.md'
8+ - ' *.md'
9+ - ' LICENSE'
910 - ' .github/**'
11+ - ' .vscode/**'
12+ - ' .gitignore'
13+ - ' *.toml'
14+ - ' *.yml'
15+ - ' *.yaml'
16+ - ' .prettierrc'
17+
1018 workflow_dispatch :
1119
1220permissions :
1321 contents : write
1422 actions : write
1523
1624jobs :
17- publish :
18- if : github.actor != 'github-actions[bot]'
25+ run-unit-tests :
26+ uses : ./.github/workflows/run-unit-tests.yml
27+
28+ release :
29+ # Block the workflow until the run-unit-tests job is complete
30+ needs : run-unit-tests
31+ # Only run if:
32+ # 1. It's a workflow_dispatch event OR
33+ # 2. It's a push event AND commit message doesn't contain [skip ci] or release
34+ if : |
35+ github.event_name == 'workflow_dispatch' ||
36+ (github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]'))
1937 runs-on : ubuntu-latest
2038 steps :
2139 - name : Checkout code
2240 uses : actions/checkout@v4
2341 with :
42+ fetch-depth : 0
2443 token : ${{ secrets.SUPERDOC_PAT }}
2544
2645 - name : Setup node
@@ -29,31 +48,17 @@ jobs:
2948 node-version : 22
3049 registry-url : https://registry.npmjs.org/
3150
32- - name : Install dependencies
33- run : npm install
34-
35- - name : Build
36- run : npm run build
37-
38- - name : Configure Git Credentials
51+ - name : Configure Git
3952 run : |
4053 git config --global user.name "github-actions[bot]"
4154 git config --global user.email "github-actions[bot]@users.noreply.github.com"
4255
43- - name : Update versions
44- run : |
45- cd packages/superdoc
46- cp ../../README.md README.md
47- npm version patch
48- git add .
49- git commit -m "[skip ci] Bump version"
50- git push
51- env :
52- GIT_TOKEN : ${{ secrets.SUPERDOC_PAT }}
56+ - name : Install dependencies
57+ run : npm install
5358
54- - name : Publish
55- run : |
56- cd packages/superdoc
57- npm publish --access public
59+ - name : Release
60+ working-directory : packages/superdoc
5861 env :
62+ GITHUB_TOKEN : ${{ secrets.SUPERDOC_PAT }}
5963 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
64+ run : npm run release
0 commit comments