@@ -4,6 +4,7 @@ run-name: "${{ format('release {0}', inputs.bump) }}" |
4 | 4 | on: |
5 | 5 | push: |
6 | 6 | branches: |
| 7 | + - ci |
7 | 8 | - dev |
8 | 9 | - snapshot-* |
9 | 10 | workflow_dispatch: |
@@ -29,69 +30,59 @@ permissions: |
29 | 30 | packages: write |
30 | 31 |
|
31 | 32 | jobs: |
32 | | - publish: |
| 33 | + version: |
33 | 34 | runs-on: blacksmith-4vcpu-ubuntu-2404 |
34 | 35 | if: github.repository == 'anomalyco/opencode' |
35 | 36 | steps: |
36 | 37 | - uses: actions/checkout@v3 |
37 | 38 | with: |
38 | | - fetch-depth: 0 |
39 | | - |
40 | | - - run: git fetch --force --tags |
41 | | - |
| 39 | + fetch-depth: 1 |
42 | 40 | - 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 }} |
43 | 52 |
|
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 |
50 | 59 | with: |
51 | | - registry: ghcr.io |
52 | | - username: ${{ github.repository_owner }} |
53 | | - password: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + fetch-depth: 1 |
| 61 | + fetch-tags: true |
54 | 62 |
|
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 |
65 | 64 |
|
66 | | - - name: Setup Git Identity |
| 65 | + - name: Build |
| 66 | + id: build |
67 | 67 | run: | |
68 | | - |
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 |
75 | 69 | 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 }} |
82 | 73 |
|
83 | 74 | - uses: actions/upload-artifact@v4 |
84 | 75 | with: |
85 | 76 | name: opencode-cli |
86 | 77 | path: packages/opencode/dist |
87 | 78 |
|
88 | 79 | 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 }} |
92 | 81 |
|
93 | | - publish-tauri: |
94 | | - needs: publish |
| 82 | + build-tauri: |
| 83 | + needs: |
| 84 | + - build-cli |
| 85 | + - version |
95 | 86 | continue-on-error: false |
96 | 87 | strategy: |
97 | 88 | fail-fast: false |
@@ -111,8 +102,8 @@ jobs: |
111 | 102 | steps: |
112 | 103 | - uses: actions/checkout@v3 |
113 | 104 | with: |
114 | | - fetch-depth: 0 |
115 | | - ref: ${{ needs.publish.outputs.tag }} |
| 105 | + fetch-depth: 1 |
| 106 | + fetch-tags: true |
116 | 107 |
|
117 | 108 | - uses: apple-actions/import-codesign-certs@v2 |
118 | 109 | if: ${{ runner.os == 'macOS' }} |
@@ -134,8 +125,6 @@ jobs: |
134 | 125 | run: | |
135 | 126 | echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8 |
136 | 127 |
|
137 | | - - run: git fetch --force --tags |
138 | | - |
139 | 128 | - uses: ./.github/actions/setup-bun |
140 | 129 |
|
141 | 130 | - name: install dependencies (ubuntu only) |
@@ -160,10 +149,7 @@ jobs: |
160 | 149 | bun ./scripts/prepare.ts |
161 | 150 | env: |
162 | 151 | OPENCODE_VERSION: ${{ needs.publish.outputs.version }} |
163 | | - NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} |
164 | 152 | GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} |
165 | | - AUR_KEY: ${{ secrets.AUR_KEY }} |
166 | | - OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} |
167 | 153 | RUST_TARGET: ${{ matrix.settings.target }} |
168 | 154 | GH_TOKEN: ${{ github.token }} |
169 | 155 | GITHUB_RUN_ID: ${{ github.run_id }} |
@@ -177,22 +163,18 @@ jobs: |
177 | 163 | cargo tauri --version |
178 | 164 |
|
179 | 165 | - name: Build and upload artifacts |
180 | | - uses: Wandalen/wretry.action@v3 |
| 166 | + uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a |
181 | 167 | timeout-minutes: 60 |
182 | 168 | 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] |
196 | 178 | env: |
197 | 179 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
198 | 180 | TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true |
@@ -205,20 +187,52 @@ jobs: |
205 | 187 | APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} |
206 | 188 | APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8 |
207 | 189 |
|
208 | | - publish-release: |
| 190 | + publish: |
209 | 191 | needs: |
210 | | - - publish |
211 | | - - publish-tauri |
212 | | - if: needs.publish.outputs.tag |
| 192 | + - version |
| 193 | + - build-cli |
| 194 | + - build-tauri |
213 | 195 | runs-on: blacksmith-4vcpu-ubuntu-2404 |
214 | 196 | steps: |
215 | 197 | - uses: actions/checkout@v3 |
216 | 198 | 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 | + |
| 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 }} |
219 | 228 |
|
220 | 229 | - uses: ./.github/actions/setup-bun |
221 | 230 |
|
| 231 | + - uses: actions/download-artifact@v4 |
| 232 | + with: |
| 233 | + name: opencode-cli |
| 234 | + path: packages/opencode/dist |
| 235 | + |
222 | 236 | - name: Setup SSH for AUR |
223 | 237 | run: | |
224 | 238 | sudo apt-get update |
@@ -230,8 +244,11 @@ jobs: |
230 | 244 | git config --global user.name "opencode" |
231 | 245 | ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true |
232 | 246 |
|
233 | | - - run: ./script/publish-complete.ts |
| 247 | + - run: ./script/publish.ts |
234 | 248 | env: |
235 | | - OPENCODE_VERSION: ${{ needs.publish.outputs.version }} |
| 249 | + OPENCODE_VERSION: ${{ needs.version.outputs.version }} |
| 250 | + OPENCODE_RELEASE: ${{ needs.version.outputs.release }} |
236 | 251 | AUR_KEY: ${{ secrets.AUR_KEY }} |
237 | 252 | GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} |
| 253 | + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} |
| 254 | + NPM_CONFIG_PROVENANCE: false |