File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 with :
2121 bun-version : 1.2.21
2222
23- - name : Install dependencies
24- run : bun install
25-
26- - name : Run format
27- run : ./script/format.ts
23+ - name : run
24+ run : |
25+ bun install
26+ ./script/format.ts
2827 env :
2928 CI : true
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ run-name: "${{ format('v{0}', inputs.version) }}"
44on :
55 workflow_dispatch :
66 inputs :
7- version :
8- description : " Version to publish "
7+ bump :
8+ description : " Bump major, minor, or patch "
99 required : true
10- type : string
11- title :
12- description : " Custom title for this run "
13- required : false
14- type : string
10+ type : choice
11+ options :
12+ - major
13+ - minor
14+ - patch
1515
1616concurrency : ${{ github.workflow }}-${{ github.ref }}
1717
6565
6666 - name : Publish
6767 run : |
68- OPENCODE_VERSION=${{ inputs.version }} ./script/publish.ts
68+ ./script/publish.ts
6969 env :
70+ OPENCODE_BUMP : ${{ inputs.bump }}
7071 GITHUB_TOKEN : ${{ secrets.SST_GITHUB_TOKEN }}
7172 AUR_KEY : ${{ secrets.AUR_KEY }}
7273 NPM_CONFIG_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change @@ -9,12 +9,18 @@ if (process.versions.bun !== "1.2.21") {
99console . log ( "=== publishing ===\n" )
1010
1111const snapshot = process . env [ "OPENCODE_SNAPSHOT" ] === "true"
12- const version = snapshot
13- ? `0.0.0-${ new Date ( ) . toISOString ( ) . slice ( 0 , 16 ) . replace ( / [ - : T ] / g, "" ) } `
14- : process . env [ "OPENCODE_VERSION" ]
15- if ( ! version ) {
16- throw new Error ( "OPENCODE_VERSION is required" )
17- }
12+ const version = await ( async ( ) => {
13+ if ( snapshot ) return `0.0.0-${ new Date ( ) . toISOString ( ) . slice ( 0 , 16 ) . replace ( / [ - : T ] / g, "" ) } `
14+ const [ major , minor , patch ] = ( await $ `gh release list --limit 1 --json tagName --jq '.[0].tagName'` . text ( ) )
15+ . trim ( )
16+ . replace ( / ^ v / , "" )
17+ . split ( "." )
18+ . map ( ( x ) => Number ( x ) || 0 )
19+ const t = process . env [ "OPENCODE_BUMP" ] ?. toLowerCase ( )
20+ if ( t === "major" ) return `${ major + 1 } .0.0`
21+ if ( t === "minor" ) return `${ major } .${ minor + 1 } .0`
22+ return `${ major } .${ minor } .${ patch + 1 } `
23+ } ) ( )
1824process . env [ "OPENCODE_VERSION" ] = version
1925console . log ( "version:" , version )
2026
You can’t perform that action at this time.
0 commit comments