publish.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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. - version
  196. if: github.repository == 'anomalyco/opencode'
  197. continue-on-error: false
  198. env:
  199. AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
  200. AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
  201. AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
  202. AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
  203. AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
  204. AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
  205. strategy:
  206. fail-fast: false
  207. matrix:
  208. settings:
  209. - host: macos-26-intel
  210. target: x86_64-apple-darwin
  211. platform_flag: --mac --x64
  212. bun_install_flags: --os=darwin --cpu=x64
  213. - host: macos-26
  214. target: aarch64-apple-darwin
  215. platform_flag: --mac --arm64
  216. bun_install_flags: --os=darwin --cpu=arm64
  217. # github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
  218. - host: "windows-2025"
  219. target: aarch64-pc-windows-msvc
  220. platform_flag: --win --arm64
  221. - host: "blacksmith-4vcpu-windows-2025"
  222. target: x86_64-pc-windows-msvc
  223. platform_flag: --win
  224. - host: "blacksmith-4vcpu-ubuntu-2404"
  225. target: x86_64-unknown-linux-gnu
  226. platform_flag: --linux
  227. - host: "blacksmith-4vcpu-ubuntu-2404-arm"
  228. target: aarch64-unknown-linux-gnu
  229. platform_flag: --linux --arm64
  230. runs-on: ${{ matrix.settings.host }}
  231. steps:
  232. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  233. - uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2.0.0
  234. if: runner.os == 'macOS'
  235. with:
  236. keychain: build
  237. p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
  238. p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  239. - name: Setup Apple API Key
  240. if: runner.os == 'macOS'
  241. run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
  242. - uses: ./.github/actions/setup-bun
  243. with:
  244. install-flags: ${{ matrix.settings.bun_install_flags }}
  245. - name: Azure login
  246. if: runner.os == 'Windows'
  247. uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
  248. with:
  249. client-id: ${{ env.AZURE_CLIENT_ID }}
  250. tenant-id: ${{ env.AZURE_TENANT_ID }}
  251. subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
  252. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  253. with:
  254. node-version: "24"
  255. - name: Cache apt packages
  256. if: contains(matrix.settings.host, 'ubuntu')
  257. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  258. with:
  259. path: ~/apt-cache
  260. key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-${{ hashFiles('.github/workflows/publish.yml') }}
  261. restore-keys: |
  262. ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-
  263. - name: Install dependencies (ubuntu only)
  264. if: contains(matrix.settings.host, 'ubuntu')
  265. run: |
  266. mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache
  267. sudo apt-get update
  268. sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" rpm
  269. sudo chmod -R a+rw ~/apt-cache
  270. - name: Setup git committer
  271. id: committer
  272. uses: ./.github/actions/setup-git-committer
  273. with:
  274. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  275. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  276. - name: Prepare
  277. run: bun ./scripts/prepare.ts
  278. working-directory: packages/desktop
  279. env:
  280. OPENCODE_VERSION: ${{ needs.version.outputs.version }}
  281. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  282. RUST_TARGET: ${{ matrix.settings.target }}
  283. - name: Build
  284. run: bun run build
  285. working-directory: packages/desktop
  286. env:
  287. NODE_OPTIONS: --max-old-space-size=4096
  288. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  289. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  290. SENTRY_ORG: ${{ vars.SENTRY_ORG }}
  291. SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
  292. SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
  293. VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
  294. VITE_SENTRY_ENVIRONMENT: ${{ (github.ref_name == 'beta' && 'beta') || 'production' }}
  295. VITE_SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
  296. - name: Package
  297. if: needs.version.outputs.release
  298. run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
  299. working-directory: packages/desktop
  300. timeout-minutes: 60
  301. env:
  302. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  303. GH_TOKEN: ${{ steps.committer.outputs.token }}
  304. CSC_KEYCHAIN: build.keychain
  305. APPLE_API_KEY: ${{ runner.temp }}/apple-api-key.p8
  306. APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY }}
  307. APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
  308. - name: Package (no publish)
  309. if: ${{ !needs.version.outputs.release }}
  310. run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
  311. working-directory: packages/desktop
  312. timeout-minutes: 60
  313. env:
  314. OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
  315. - name: Create macOS .app.tar.gz
  316. if: runner.os == 'macOS' && needs.version.outputs.release
  317. working-directory: packages/desktop/dist
  318. run: |
  319. if [[ "${{ matrix.settings.target }}" == "x86_64-apple-darwin" ]]; then
  320. APP_DIR="mac"
  321. OUT_NAME="opencode-desktop-mac-x64.app.tar.gz"
  322. elif [[ "${{ matrix.settings.target }}" == "aarch64-apple-darwin" ]]; then
  323. APP_DIR="mac-arm64"
  324. OUT_NAME="opencode-desktop-mac-arm64.app.tar.gz"
  325. else
  326. echo "Unknown macOS target: ${{ matrix.settings.target }}"
  327. exit 1
  328. fi
  329. APP_PATH=$(find "$APP_DIR" -maxdepth 1 -name "*.app" -type d | head -1)
  330. if [ -z "$APP_PATH" ]; then
  331. echo "No .app bundle found in $APP_DIR"
  332. exit 1
  333. fi
  334. tar -czf "$OUT_NAME" -C "$(dirname "$APP_PATH")" "$(basename "$APP_PATH")"
  335. - name: Verify signed Windows Electron artifacts
  336. if: runner.os == 'Windows'
  337. shell: pwsh
  338. run: |
  339. $files = @()
  340. $files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*.exe" | Select-Object -ExpandProperty FullName
  341. $files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*unpacked\*.exe" | Select-Object -ExpandProperty FullName
  342. $files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*unpacked\resources\opencode-cli.exe" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
  343. foreach ($file in $files | Select-Object -Unique) {
  344. $sig = Get-AuthenticodeSignature $file
  345. if ($sig.Status -ne "Valid") {
  346. throw "Invalid signature for ${file}: $($sig.Status)"
  347. }
  348. }
  349. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  350. with:
  351. name: opencode-desktop-${{ matrix.settings.target }}
  352. path: packages/desktop/dist/*
  353. - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
  354. if: needs.version.outputs.release
  355. with:
  356. name: latest-yml-${{ matrix.settings.target }}
  357. path: packages/desktop/dist/latest*.yml
  358. publish:
  359. needs:
  360. - version
  361. - build-cli
  362. - sign-cli-windows
  363. - build-electron
  364. if: always() && !failure() && !cancelled()
  365. runs-on: blacksmith-4vcpu-ubuntu-2404
  366. steps:
  367. - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
  368. - uses: ./.github/actions/setup-bun
  369. - name: Login to GitHub Container Registry
  370. uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
  371. with:
  372. registry: ghcr.io
  373. username: ${{ github.repository_owner }}
  374. password: ${{ secrets.GITHUB_TOKEN }}
  375. - name: Set up QEMU
  376. uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
  377. - name: Set up Docker Buildx
  378. uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
  379. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  380. with:
  381. node-version: "24"
  382. registry-url: "https://registry.npmjs.org"
  383. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  384. with:
  385. name: opencode-cli
  386. path: packages/opencode/dist
  387. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  388. with:
  389. name: opencode-cli-windows
  390. path: packages/opencode/dist
  391. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  392. with:
  393. name: opencode-cli-signed-windows
  394. path: packages/opencode/dist
  395. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  396. with:
  397. name: opencode-preview-cli
  398. path: packages/cli/dist
  399. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  400. if: needs.version.outputs.release
  401. with:
  402. pattern: latest-yml-*
  403. path: /tmp/latest-yml
  404. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
  405. if: needs.version.outputs.release
  406. with:
  407. pattern: opencode-desktop-*
  408. path: /tmp/desktop
  409. merge-multiple: true
  410. - name: Setup git committer
  411. id: committer
  412. uses: ./.github/actions/setup-git-committer
  413. with:
  414. opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
  415. opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
  416. - name: Cache apt packages (AUR)
  417. uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
  418. with:
  419. path: /var/cache/apt/archives
  420. key: ${{ runner.os }}-apt-aur-${{ hashFiles('.github/workflows/publish.yml') }}
  421. restore-keys: |
  422. ${{ runner.os }}-apt-aur-
  423. - name: Setup SSH for AUR
  424. run: |
  425. sudo apt-get update
  426. sudo apt-get install -y pacman-package-manager
  427. mkdir -p ~/.ssh
  428. echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa
  429. chmod 600 ~/.ssh/id_rsa
  430. git config --global user.email "opencode@sst.dev"
  431. git config --global user.name "opencode"
  432. ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true
  433. - name: Upload desktop release assets
  434. if: needs.version.outputs.release
  435. env:
  436. GH_TOKEN: ${{ steps.committer.outputs.token }}
  437. run: |
  438. shopt -s nullglob
  439. files=(/tmp/desktop/*.{exe,blockmap,dmg,zip,AppImage,deb,rpm} /tmp/desktop/*.app.tar.gz)
  440. if (( ${#files[@]} == 0 )); then
  441. echo "No desktop release assets found"
  442. exit 1
  443. fi
  444. gh release upload "v${{ needs.version.outputs.version }}" "${files[@]}" --clobber --repo "${{ needs.version.outputs.repo }}"
  445. - run: ./script/publish.ts
  446. env:
  447. OPENCODE_VERSION: ${{ needs.version.outputs.version }}
  448. OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
  449. AUR_KEY: ${{ secrets.AUR_KEY }}
  450. GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
  451. GH_REPO: ${{ needs.version.outputs.repo }}
  452. NPM_CONFIG_PROVENANCE: false
  453. LATEST_YML_DIR: /tmp/latest-yml
  454. TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
  455. TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}