publish.yml 21 KB

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