publish.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. name: publish
  2. run-name: "${{ format('release {0}', inputs.bump) }}"
  3. on:
  4. push:
  5. branches:
  6. - ci
  7. - dev
  8. - v2
  9. - beta
  10. - fix/npm-native-binary-install
  11. - snapshot-*
  12. workflow_dispatch:
  13. inputs:
  14. bump:
  15. description: "Bump major, minor, or patch"
  16. required: false
  17. type: choice
  18. options:
  19. - major
  20. - minor
  21. - patch
  22. version:
  23. description: "Override version (optional)"
  24. required: false
  25. type: string
  26. concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.version || inputs.bump }}
  27. permissions:
  28. id-token: write
  29. contents: write
  30. packages: write
  31. env:
  32. OPENCODE_CHANNEL: ${{ (github.ref_name == 'v2' && 'next') || '' }}
  33. jobs:
  34. version:
  35. runs-on: blacksmith-4vcpu-ubuntu-2404
  36. if: github.repository == 'anomalyco/opencode'
  37. steps:
  38. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  39. with:
  40. fetch-depth: 0
  41. - uses: ./.github/actions/setup-bun
  42. - name: Setup git committer
  43. id: committer
  44. uses: ./.github/actions/setup-git-committer
  45. with:
  46. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  47. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  48. - name: Install OpenCode
  49. if: inputs.bump || inputs.version
  50. run: bun i -g opencode-ai
  51. - id: version
  52. run: |
  53. ./script/version.ts
  54. env:
  55. GH_TOKEN: ${{ steps.committer.outputs.token }}
  56. OPENCODE_BUMP: ${{ inputs.bump }}
  57. OPENCODE_VERSION: ${{ inputs.version }}
  58. OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
  59. GH_REPO: ${{ (github.ref_name == 'beta' && 'anomalyco/opencode-beta') || github.repository }}
  60. outputs:
  61. version: ${{ steps.version.outputs.version }}
  62. release: ${{ steps.version.outputs.release }}
  63. tag: ${{ steps.version.outputs.tag }}
  64. repo: ${{ steps.version.outputs.repo }}
  65. build-cli:
  66. needs: version
  67. runs-on: blacksmith-4vcpu-ubuntu-2404
  68. if: github.repository == 'anomalyco/opencode'
  69. steps:
  70. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  71. with:
  72. fetch-tags: true
  73. - uses: ./.github/actions/setup-bun
  74. - name: Setup git committer
  75. id: committer
  76. uses: ./.github/actions/setup-git-committer
  77. with:
  78. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  79. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  80. - name: Build
  81. id: build
  82. run: |
  83. ./packages/opencode/script/build.ts ${{ (github.ref_name == 'beta' && '--sourcemaps') || '' }}
  84. ./packages/cli/script/build.ts ${{ (github.ref_name == 'beta' && '--sourcemaps') || '' }}
  85. env:
  86. OPENCODE_VERSION: ${{ needs.version.outputs.version }}
  87. OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
  88. GH_REPO: ${{ needs.version.outputs.repo }}
  89. GH_TOKEN: ${{ steps.committer.outputs.token }}
  90. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  91. with:
  92. name: opencode-cli
  93. path: |
  94. packages/opencode/dist/opencode-darwin*
  95. packages/opencode/dist/opencode-linux*
  96. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  97. with:
  98. name: opencode-cli-windows
  99. path: packages/opencode/dist/opencode-windows*
  100. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  101. with:
  102. name: opencode-preview-cli
  103. path: packages/cli/dist/cli-*
  104. outputs:
  105. version: ${{ needs.version.outputs.version }}
  106. sign-cli-windows:
  107. needs:
  108. - build-cli
  109. - version
  110. runs-on: blacksmith-4vcpu-windows-2025
  111. if: github.repository == 'anomalyco/opencode' && github.ref_name != 'v2'
  112. env:
  113. AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
  114. AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
  115. AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
  116. AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
  117. AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
  118. AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
  119. steps:
  120. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  121. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  122. with:
  123. name: opencode-cli-windows
  124. path: packages/opencode/dist
  125. - name: Setup git committer
  126. id: committer
  127. uses: ./.github/actions/setup-git-committer
  128. with:
  129. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  130. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  131. - name: Azure login
  132. uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
  133. with:
  134. client-id: ${{ env.AZURE_CLIENT_ID }}
  135. tenant-id: ${{ env.AZURE_TENANT_ID }}
  136. subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
  137. - uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1.2.0
  138. with:
  139. endpoint: ${{ env.AZURE_TRUSTED_SIGNING_ENDPOINT }}
  140. signing-account-name: ${{ env.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
  141. certificate-profile-name: ${{ env.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
  142. files: |
  143. ${{ github.workspace }}\packages\opencode\dist\opencode-windows-arm64\bin\opencode.exe
  144. ${{ github.workspace }}\packages\opencode\dist\opencode-windows-x64\bin\opencode.exe
  145. ${{ github.workspace }}\packages\opencode\dist\opencode-windows-x64-baseline\bin\opencode.exe
  146. exclude-environment-credential: true
  147. exclude-workload-identity-credential: true
  148. exclude-managed-identity-credential: true
  149. exclude-shared-token-cache-credential: true
  150. exclude-visual-studio-credential: true
  151. exclude-visual-studio-code-credential: true
  152. exclude-azure-cli-credential: false
  153. exclude-azure-powershell-credential: true
  154. exclude-azure-developer-cli-credential: true
  155. exclude-interactive-browser-credential: true
  156. - name: Verify Windows CLI signatures
  157. shell: pwsh
  158. run: |
  159. $files = @(
  160. "${{ github.workspace }}\packages\opencode\dist\opencode-windows-arm64\bin\opencode.exe",
  161. "${{ github.workspace }}\packages\opencode\dist\opencode-windows-x64\bin\opencode.exe",
  162. "${{ github.workspace }}\packages\opencode\dist\opencode-windows-x64-baseline\bin\opencode.exe"
  163. )
  164. foreach ($file in $files) {
  165. $sig = Get-AuthenticodeSignature $file
  166. if ($sig.Status -ne "Valid") {
  167. throw "Invalid signature for ${file}: $($sig.Status)"
  168. }
  169. }
  170. - name: Repack Windows CLI archives
  171. working-directory: packages/opencode/dist
  172. shell: pwsh
  173. run: |
  174. Compress-Archive -Path "opencode-windows-arm64\bin\*" -DestinationPath "opencode-windows-arm64.zip" -Force
  175. Compress-Archive -Path "opencode-windows-x64\bin\*" -DestinationPath "opencode-windows-x64.zip" -Force
  176. Compress-Archive -Path "opencode-windows-x64-baseline\bin\*" -DestinationPath "opencode-windows-x64-baseline.zip" -Force
  177. - name: Upload signed Windows CLI release assets
  178. if: needs.version.outputs.release != ''
  179. shell: pwsh
  180. env:
  181. GH_TOKEN: ${{ steps.committer.outputs.token }}
  182. run: |
  183. gh release upload "v${{ needs.version.outputs.version }}" `
  184. "${{ github.workspace }}\packages\opencode\dist\opencode-windows-arm64.zip" `
  185. "${{ github.workspace }}\packages\opencode\dist\opencode-windows-x64.zip" `
  186. "${{ github.workspace }}\packages\opencode\dist\opencode-windows-x64-baseline.zip" `
  187. --clobber `
  188. --repo "${{ needs.version.outputs.repo }}"
  189. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  190. with:
  191. name: opencode-cli-signed-windows
  192. path: |
  193. packages/opencode/dist/opencode-windows-arm64
  194. packages/opencode/dist/opencode-windows-x64
  195. packages/opencode/dist/opencode-windows-x64-baseline
  196. build-electron:
  197. needs:
  198. - build-cli
  199. - version
  200. if: github.repository == 'anomalyco/opencode' && github.ref_name != 'v2'
  201. continue-on-error: false
  202. env:
  203. AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
  204. AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
  205. AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
  206. AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
  207. AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
  208. AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
  209. strategy:
  210. fail-fast: false
  211. matrix:
  212. settings:
  213. - host: macos-26-intel
  214. target: x86_64-apple-darwin
  215. platform_flag: --mac --x64
  216. bun_install_flags: --os=darwin --cpu=x64
  217. - host: macos-26
  218. target: aarch64-apple-darwin
  219. platform_flag: --mac --arm64
  220. bun_install_flags: --os=darwin --cpu=arm64
  221. # github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
  222. - host: "windows-2025"
  223. target: aarch64-pc-windows-msvc
  224. platform_flag: --win --arm64
  225. - host: "blacksmith-4vcpu-windows-2025"
  226. target: x86_64-pc-windows-msvc
  227. platform_flag: --win
  228. - host: "blacksmith-4vcpu-ubuntu-2404"
  229. target: x86_64-unknown-linux-gnu
  230. platform_flag: --linux
  231. - host: "blacksmith-4vcpu-ubuntu-2404-arm"
  232. target: aarch64-unknown-linux-gnu
  233. platform_flag: --linux --arm64
  234. runs-on: ${{ matrix.settings.host }}
  235. steps:
  236. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  237. - uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2.0.0
  238. if: runner.os == 'macOS'
  239. with:
  240. keychain: build
  241. p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
  242. p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  243. - name: Setup Apple API Key
  244. if: runner.os == 'macOS'
  245. run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
  246. - uses: ./.github/actions/setup-bun
  247. with:
  248. install-flags: ${{ matrix.settings.bun_install_flags }}
  249. - name: Azure login
  250. if: runner.os == 'Windows'
  251. uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
  252. with:
  253. client-id: ${{ env.AZURE_CLIENT_ID }}
  254. tenant-id: ${{ env.AZURE_TENANT_ID }}
  255. subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
  256. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  257. with:
  258. node-version: "24"
  259. - name: Cache apt packages
  260. if: contains(matrix.settings.host, 'ubuntu')
  261. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  262. with:
  263. path: ~/apt-cache
  264. key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-${{ hashFiles('.github/workflows/publish.yml') }}
  265. restore-keys: |
  266. ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-
  267. - name: Install dependencies (ubuntu only)
  268. if: contains(matrix.settings.host, 'ubuntu')
  269. run: |
  270. mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache
  271. sudo apt-get update
  272. sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" rpm
  273. sudo chmod -R a+rw ~/apt-cache
  274. - name: Setup git committer
  275. id: committer
  276. uses: ./.github/actions/setup-git-committer
  277. with:
  278. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  279. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  280. - name: Prepare
  281. run: bun ./scripts/prepare.ts
  282. working-directory: packages/desktop
  283. env:
  284. OPENCODE_VERSION: ${{ needs.version.outputs.version }}
  285. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  286. OPENCODE_CLI_ARTIFACT: ${{ (runner.os == 'Windows' && 'opencode-cli-windows') || 'opencode-cli' }}
  287. RUST_TARGET: ${{ matrix.settings.target }}
  288. GH_TOKEN: ${{ github.token }}
  289. GITHUB_RUN_ID: ${{ github.run_id }}
  290. - name: Build
  291. run: bun run build
  292. working-directory: packages/desktop
  293. env:
  294. NODE_OPTIONS: --max-old-space-size=4096
  295. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  296. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  297. SENTRY_ORG: ${{ vars.SENTRY_ORG }}
  298. SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
  299. SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
  300. VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
  301. VITE_SENTRY_ENVIRONMENT: ${{ (github.ref_name == 'beta' && 'beta') || 'production' }}
  302. VITE_SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
  303. - name: Package
  304. if: needs.version.outputs.release
  305. run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
  306. working-directory: packages/desktop
  307. timeout-minutes: 60
  308. env:
  309. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  310. GH_TOKEN: ${{ steps.committer.outputs.token }}
  311. CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }}
  312. CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  313. APPLE_API_KEY: ${{ runner.temp }}/apple-api-key.p8
  314. APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY }}
  315. APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
  316. - name: Package (no publish)
  317. if: ${{ !needs.version.outputs.release }}
  318. run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
  319. working-directory: packages/desktop
  320. timeout-minutes: 60
  321. env:
  322. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  323. - name: Create macOS .app.tar.gz
  324. if: runner.os == 'macOS' && needs.version.outputs.release
  325. working-directory: packages/desktop/dist
  326. run: |
  327. if [[ "${{ matrix.settings.target }}" == "x86_64-apple-darwin" ]]; then
  328. APP_DIR="mac"
  329. OUT_NAME="opencode-desktop-mac-x64.app.tar.gz"
  330. elif [[ "${{ matrix.settings.target }}" == "aarch64-apple-darwin" ]]; then
  331. APP_DIR="mac-arm64"
  332. OUT_NAME="opencode-desktop-mac-arm64.app.tar.gz"
  333. else
  334. echo "Unknown macOS target: ${{ matrix.settings.target }}"
  335. exit 1
  336. fi
  337. APP_PATH=$(find "$APP_DIR" -maxdepth 1 -name "*.app" -type d | head -1)
  338. if [ -z "$APP_PATH" ]; then
  339. echo "No .app bundle found in $APP_DIR"
  340. exit 1
  341. fi
  342. tar -czf "$OUT_NAME" -C "$(dirname "$APP_PATH")" "$(basename "$APP_PATH")"
  343. - name: Verify signed Windows Electron artifacts
  344. if: runner.os == 'Windows'
  345. shell: pwsh
  346. run: |
  347. $files = @()
  348. $files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*.exe" | Select-Object -ExpandProperty FullName
  349. $files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*unpacked\*.exe" | Select-Object -ExpandProperty FullName
  350. $files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*unpacked\resources\opencode-cli.exe" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
  351. foreach ($file in $files | Select-Object -Unique) {
  352. $sig = Get-AuthenticodeSignature $file
  353. if ($sig.Status -ne "Valid") {
  354. throw "Invalid signature for ${file}: $($sig.Status)"
  355. }
  356. }
  357. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  358. with:
  359. name: opencode-desktop-${{ matrix.settings.target }}
  360. path: packages/desktop/dist/*
  361. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  362. if: needs.version.outputs.release
  363. with:
  364. name: latest-yml-${{ matrix.settings.target }}
  365. path: packages/desktop/dist/latest*.yml
  366. publish:
  367. needs:
  368. - version
  369. - build-cli
  370. - sign-cli-windows
  371. - build-electron
  372. if: always() && !failure() && !cancelled()
  373. runs-on: blacksmith-4vcpu-ubuntu-2404
  374. steps:
  375. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  376. - uses: ./.github/actions/setup-bun
  377. - name: Login to GitHub Container Registry
  378. uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
  379. with:
  380. registry: ghcr.io
  381. username: ${{ github.repository_owner }}
  382. password: ${{ secrets.GITHUB_TOKEN }}
  383. - name: Set up QEMU
  384. uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
  385. - name: Set up Docker Buildx
  386. uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
  387. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  388. with:
  389. node-version: "24"
  390. registry-url: "https://registry.npmjs.org"
  391. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  392. with:
  393. name: opencode-cli
  394. path: packages/opencode/dist
  395. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  396. with:
  397. name: opencode-cli-windows
  398. path: packages/opencode/dist
  399. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  400. if: github.ref_name != 'v2'
  401. with:
  402. name: opencode-cli-signed-windows
  403. path: packages/opencode/dist
  404. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  405. with:
  406. name: opencode-preview-cli
  407. path: packages/cli/dist
  408. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  409. if: needs.version.outputs.release
  410. with:
  411. pattern: latest-yml-*
  412. path: /tmp/latest-yml
  413. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  414. if: needs.version.outputs.release
  415. with:
  416. pattern: opencode-desktop-*
  417. path: /tmp/desktop
  418. merge-multiple: true
  419. - name: Setup git committer
  420. id: committer
  421. uses: ./.github/actions/setup-git-committer
  422. with:
  423. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  424. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  425. - name: Cache apt packages (AUR)
  426. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  427. with:
  428. path: /var/cache/apt/archives
  429. key: ${{ runner.os }}-apt-aur-${{ hashFiles('.github/workflows/publish.yml') }}
  430. restore-keys: |
  431. ${{ runner.os }}-apt-aur-
  432. - name: Setup SSH for AUR
  433. run: |
  434. sudo apt-get update
  435. sudo apt-get install -y pacman-package-manager
  436. mkdir -p ~/.ssh
  437. echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa
  438. chmod 600 ~/.ssh/id_rsa
  439. git config --global user.email "opencode@sst.dev"
  440. git config --global user.name "opencode"
  441. ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true
  442. - name: Upload desktop release assets
  443. if: needs.version.outputs.release
  444. env:
  445. GH_TOKEN: ${{ steps.committer.outputs.token }}
  446. run: |
  447. shopt -s nullglob
  448. files=(/tmp/desktop/*.{exe,blockmap,dmg,zip,AppImage,deb,rpm} /tmp/desktop/*.app.tar.gz)
  449. if (( ${#files[@]} == 0 )); then
  450. echo "No desktop release assets found"
  451. exit 1
  452. fi
  453. gh release upload "v${{ needs.version.outputs.version }}" "${files[@]}" --clobber --repo "${{ needs.version.outputs.repo }}"
  454. - run: ./script/publish.ts
  455. env:
  456. OPENCODE_VERSION: ${{ needs.version.outputs.version }}
  457. OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
  458. AUR_KEY: ${{ secrets.AUR_KEY }}
  459. GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
  460. GH_REPO: ${{ needs.version.outputs.repo }}
  461. NPM_CONFIG_PROVENANCE: false
  462. LATEST_YML_DIR: /tmp/latest-yml
  463. TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
  464. TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}