publish.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: publish
  2. run-name: "${{ format('release {0}', inputs.bump) }}"
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. bump:
  7. description: "Bump major, minor, or patch"
  8. required: true
  9. type: choice
  10. options:
  11. - major
  12. - minor
  13. - patch
  14. version:
  15. description: "Override version (optional)"
  16. required: false
  17. type: string
  18. concurrency: ${{ github.workflow }}-${{ github.ref }}
  19. permissions:
  20. contents: write
  21. packages: write
  22. jobs:
  23. publish:
  24. runs-on: ubuntu-latest
  25. steps:
  26. - uses: actions/checkout@v3
  27. with:
  28. fetch-depth: 0
  29. - run: git fetch --force --tags
  30. - uses: actions/setup-go@v5
  31. with:
  32. go-version: ">=1.24.0"
  33. cache: true
  34. cache-dependency-path: go.sum
  35. - uses: ./.github/actions/setup-bun
  36. - name: Install makepkg
  37. run: |
  38. sudo apt-get update
  39. sudo apt-get install -y pacman-package-manager
  40. - name: Setup SSH for AUR
  41. run: |
  42. mkdir -p ~/.ssh
  43. echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa
  44. chmod 600 ~/.ssh/id_rsa
  45. git config --global user.email "[email protected]"
  46. git config --global user.name "opencode"
  47. ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true
  48. - name: Install OpenCode
  49. run: curl -fsSL https://opencode.ai/install | bash
  50. - name: Setup npm auth
  51. run: |
  52. echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
  53. - name: Login to GitHub Container Registry
  54. uses: docker/login-action@v3
  55. with:
  56. registry: ghcr.io
  57. username: ${{ github.repository_owner }}
  58. password: ${{ secrets.GITHUB_TOKEN }}
  59. - name: Publish
  60. run: |
  61. ./script/publish.ts
  62. env:
  63. OPENCODE_BUMP: ${{ inputs.bump }}
  64. OPENCODE_VERSION: ${{ inputs.version }}
  65. OPENCODE_CHANNEL: latest
  66. NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
  67. GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
  68. AUR_KEY: ${{ secrets.AUR_KEY }}
  69. OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}