@@ -4,6 +4,7 @@ run-name: "${{ format('release {0}', inputs.bump) }}"
44on :
55 push :
66 branches :
7+ - ci
78 - dev
89 - snapshot-*
910 workflow_dispatch :
@@ -29,69 +30,59 @@ permissions:
2930 packages : write
3031
3132jobs :
32- publish :
33+ version :
3334 runs-on : blacksmith-4vcpu-ubuntu-2404
3435 if : github.repository == 'anomalyco/opencode'
3536 steps :
3637 - uses : actions/checkout@v3
3738 with :
38- fetch-depth : 0
39-
40- - run : git fetch --force --tags
41-
39+ fetch-depth : 1
4240 - uses : ./.github/actions/setup-bun
41+ - id : version
42+ run : |
43+ ./script/version.ts
44+ env :
45+ GH_TOKEN : ${{ github.token }}
46+ OPENCODE_BUMP : ${{ inputs.bump }}
47+ OPENCODE_VERSION : ${{ inputs.version }}
48+ outputs :
49+ version : ${{ steps.version.outputs.version }}
50+ release : ${{ steps.version.outputs.release }}
51+ tag : ${{ steps.version.outputs.tag }}
4352
44- - name : Install OpenCode
45- if : inputs.bump || inputs. version
46- 47-
48- - name : Login to GitHub Container Registry
49- uses : docker/login-action @v3
53+ build-cli :
54+ needs : version
55+ runs-on : blacksmith-4vcpu-ubuntu-2404
56+ if : github.repository == 'anomalyco/opencode'
57+ steps :
58+ - uses : actions/checkout @v3
5059 with :
51- registry : ghcr.io
52- username : ${{ github.repository_owner }}
53- password : ${{ secrets.GITHUB_TOKEN }}
60+ fetch-depth : 1
61+ fetch-tags : true
5462
55- - name : Set up QEMU
56- uses : docker/setup-qemu-action@v3
57-
58- - name : Set up Docker Buildx
59- uses : docker/setup-buildx-action@v3
60-
61- - uses : actions/setup-node@v4
62- with :
63- node-version : " 24"
64- registry-url : " https://registry.npmjs.org"
63+ - uses : ./.github/actions/setup-bun
6564
66- - name : Setup Git Identity
65+ - name : Build
66+ id : build
6767 run : |
68- git config --global user.email "[email protected] " 69- git config --global user.name "opencode"
70- git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
71-
72- - name : Publish
73- id : publish
74- run : ./script/publish-start.ts
68+ ./packages/opencode/script/build.ts
7569 env :
76- OPENCODE_BUMP : ${{ inputs.bump }}
77- OPENCODE_VERSION : ${{ inputs.version }}
78- OPENCODE_API_KEY : ${{ secrets.OPENCODE_API_KEY }}
79- AUR_KEY : ${{ secrets.AUR_KEY }}
80- GITHUB_TOKEN : ${{ secrets.SST_GITHUB_TOKEN }}
81- NPM_CONFIG_PROVENANCE : false
70+ OPENCODE_VERSION : ${{ needs.version.outputs.version }}
71+ OPENCODE_RELEASE : ${{ needs.version.outputs.release }}
72+ GH_TOKEN : ${{ github.token }}
8273
8374 - uses : actions/upload-artifact@v4
8475 with :
8576 name : opencode-cli
8677 path : packages/opencode/dist
8778
8879 outputs :
89- release : ${{ steps.publish.outputs.release }}
90- tag : ${{ steps.publish.outputs.tag }}
91- version : ${{ steps.publish.outputs.version }}
80+ version : ${{ needs.version.outputs.version }}
9281
93- publish-tauri :
94- needs : publish
82+ build-tauri :
83+ needs :
84+ - build-cli
85+ - version
9586 continue-on-error : false
9687 strategy :
9788 fail-fast : false
@@ -111,8 +102,8 @@ jobs:
111102 steps :
112103 - uses : actions/checkout@v3
113104 with :
114- fetch-depth : 0
115- ref : ${{ needs.publish.outputs.tag }}
105+ fetch-depth : 1
106+ fetch-tags : true
116107
117108 - uses : apple-actions/import-codesign-certs@v2
118109 if : ${{ runner.os == 'macOS' }}
@@ -134,8 +125,6 @@ jobs:
134125 run : |
135126 echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
136127
137- - run : git fetch --force --tags
138-
139128 - uses : ./.github/actions/setup-bun
140129
141130 - name : install dependencies (ubuntu only)
@@ -160,10 +149,7 @@ jobs:
160149 bun ./scripts/prepare.ts
161150 env :
162151 OPENCODE_VERSION : ${{ needs.publish.outputs.version }}
163- NPM_CONFIG_TOKEN : ${{ secrets.NPM_TOKEN }}
164152 GITHUB_TOKEN : ${{ secrets.SST_GITHUB_TOKEN }}
165- AUR_KEY : ${{ secrets.AUR_KEY }}
166- OPENCODE_API_KEY : ${{ secrets.OPENCODE_API_KEY }}
167153 RUST_TARGET : ${{ matrix.settings.target }}
168154 GH_TOKEN : ${{ github.token }}
169155 GITHUB_RUN_ID : ${{ github.run_id }}
@@ -177,22 +163,18 @@ jobs:
177163 cargo tauri --version
178164
179165 - name : Build and upload artifacts
180- uses : Wandalen/wretry. action@v3
166+ uses : tauri-apps/tauri- action@390cbe447412ced1303d35abe75287949e43437a
181167 timeout-minutes : 60
182168 with :
183- attempt_limit : 3
184- attempt_delay : 10000
185- action : tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
186- with : |
187- projectPath: packages/desktop
188- uploadWorkflowArtifacts: true
189- tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
190- args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
191- updaterJsonPreferNsis: true
192- releaseId: ${{ needs.publish.outputs.release }}
193- tagName: ${{ needs.publish.outputs.tag }}
194- releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
195- releaseDraft: true
169+ projectPath : packages/desktop
170+ uploadWorkflowArtifacts : true
171+ tauriScript : ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
172+ args : --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
173+ updaterJsonPreferNsis : true
174+ releaseId : ${{ needs.version.outputs.release }}
175+ tagName : ${{ needs.version.outputs.tag }}
176+ releaseDraft : true
177+ releaseAssetNamePattern : opencode-desktop-[platform]-[arch][ext]
196178 env :
197179 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
198180 TAURI_BUNDLER_NEW_APPIMAGE_FORMAT : true
@@ -205,20 +187,52 @@ jobs:
205187 APPLE_API_KEY : ${{ secrets.APPLE_API_KEY }}
206188 APPLE_API_KEY_PATH : ${{ runner.temp }}/apple-api-key.p8
207189
208- publish-release :
190+ publish :
209191 needs :
210- - publish
211- - publish-tauri
212- if : needs.publish.outputs.tag
192+ - version
193+ - build-cli
194+ - build-tauri
213195 runs-on : blacksmith-4vcpu-ubuntu-2404
214196 steps :
215197 - uses : actions/checkout@v3
216198 with :
217- fetch-depth : 0
218- ref : ${{ needs.publish.outputs.tag }}
199+ fetch-depth : 1
200+
201+ - name : Install OpenCode
202+ if : inputs.bump || inputs.version
203+ run : bun i -g opencode-ai
204+
205+ - name : Login to GitHub Container Registry
206+ uses : docker/login-action@v3
207+ with :
208+ registry : ghcr.io
209+ username : ${{ github.repository_owner }}
210+ password : ${{ secrets.GITHUB_TOKEN }}
211+
212+ - name : Set up QEMU
213+ uses : docker/setup-qemu-action@v3
214+
215+ - name : Set up Docker Buildx
216+ uses : docker/setup-buildx-action@v3
217+
218+ - uses : actions/setup-node@v4
219+ with :
220+ node-version : " 24"
221+ registry-url : " https://registry.npmjs.org"
222+
223+ - name : Setup Git Identity
224+ run : |
225+ git config --global user.email "[email protected] " 226+ git config --global user.name "opencode"
227+ git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
219228
220229 - uses : ./.github/actions/setup-bun
221230
231+ - uses : actions/download-artifact@v4
232+ with :
233+ name : opencode-cli
234+ path : packages/opencode/dist
235+
222236 - name : Setup SSH for AUR
223237 run : |
224238 sudo apt-get update
@@ -230,8 +244,11 @@ jobs:
230244 git config --global user.name "opencode"
231245 ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true
232246
233- - run : ./script/publish-complete .ts
247+ - run : ./script/publish.ts
234248 env :
235- OPENCODE_VERSION : ${{ needs.publish.outputs.version }}
249+ OPENCODE_VERSION : ${{ needs.version.outputs.version }}
250+ OPENCODE_RELEASE : ${{ needs.version.outputs.release }}
236251 AUR_KEY : ${{ secrets.AUR_KEY }}
237252 GITHUB_TOKEN : ${{ secrets.SST_GITHUB_TOKEN }}
253+ OPENCODE_API_KEY : ${{ secrets.OPENCODE_API_KEY }}
254+ NPM_CONFIG_PROVENANCE : false
0 commit comments