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 : Publish create-spawn-dock
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+ branches :
8+ - main
9+
10+ env :
11+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
12+
13+ permissions : {}
14+
15+ jobs :
16+ publish :
17+ runs-on : ubuntu-latest
18+ timeout-minutes : 15
19+ steps :
20+ - uses : actions/checkout@v6
21+
22+ - name : Install dependencies
23+ uses : ./.github/actions/setup
24+
25+ - name : Run checks
26+ run : pnpm typecheck
27+
28+ - name : Run tests
29+ run : pnpm test
30+
31+ - name : Build package
32+ run : pnpm build
33+
34+ - name : Configure npm registry
35+ uses : actions/setup-node@v6
36+ with :
37+ node-version : 22.12.0
38+ registry-url : https://registry.npmjs.org
39+
40+ - name : Determine publish version
41+ id : version
42+ shell : bash
43+ run : |
44+ if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
45+ echo "type=release" >> "$GITHUB_OUTPUT"
46+ echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
47+ else
48+ SHORT_SHA="${GITHUB_SHA::7}"
49+ TIMESTAMP="$(date +%Y%m%d%H%M%S)"
50+ CURRENT="$(node -p "require('./package.json').version")"
51+ echo "type=canary" >> "$GITHUB_OUTPUT"
52+ echo "version=${CURRENT}-canary.${TIMESTAMP}.${SHORT_SHA}" >> "$GITHUB_OUTPUT"
53+ fi
54+
55+ - name : Set package version
56+ run : npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
57+
58+ - name : Publish release
59+ if : steps.version.outputs.type == 'release'
60+ run : npm publish
61+ env :
62+ NODE_AUTH_TOKEN : ${{ secrets.NPM_KEY }}
63+
64+ - name : Publish canary
65+ if : steps.version.outputs.type == 'canary'
66+ run : npm publish --tag canary
67+ env :
68+ NODE_AUTH_TOKEN : ${{ secrets.NPM_KEY }}
Original file line number Diff line number Diff line change 2727 "create-spawn-dock" : " ./packages/app/dist/src/app/main.js"
2828 },
2929 "scripts" : {
30- "prepare" : " corepack pnpm build " ,
30+ "prepare" : " node ./scripts/prepare.mjs " ,
3131 "build" : " pnpm --filter @create-spawn-dock/app build" ,
3232 "check" : " pnpm --filter @create-spawn-dock/app check" ,
3333 "test" : " pnpm --filter @create-spawn-dock/app test" ,
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ import { spawnSync } from "node:child_process"
3+
4+ const commands = [
5+ [ "pnpm" , [ "build" ] ] ,
6+ [ "corepack" , [ "pnpm" , "build" ] ] ,
7+ ]
8+
9+ let lastStatus = 1
10+
11+ for ( const [ command , args ] of commands ) {
12+ const result = spawnSync ( command , args , {
13+ stdio : "inherit" ,
14+ } )
15+
16+ if ( result . error && result . error . code === "ENOENT" ) {
17+ continue
18+ }
19+
20+ lastStatus = result . status ?? 1
21+
22+ if ( lastStatus === 0 ) {
23+ process . exit ( 0 )
24+ }
25+ }
26+
27+ process . exit ( lastStatus )
You can’t perform that action at this time.
0 commit comments