publish.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: publish
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - dev
  7. tags:
  8. - "*"
  9. concurrency: ${{ github.workflow }}-${{ github.ref }}
  10. permissions:
  11. contents: write
  12. packages: write
  13. jobs:
  14. publish:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v3
  18. with:
  19. fetch-depth: 0
  20. - run: git fetch --force --tags
  21. - uses: actions/setup-go@v5
  22. with:
  23. go-version: ">=1.24.0"
  24. cache: true
  25. cache-dependency-path: go.sum
  26. - uses: oven-sh/setup-bun@v2
  27. with:
  28. bun-version: 1.2.17
  29. - name: Install makepkg
  30. run: |
  31. sudo apt-get update
  32. sudo apt-get install -y pacman-package-manager
  33. - name: Setup SSH for AUR
  34. run: |
  35. mkdir -p ~/.ssh
  36. echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa
  37. chmod 600 ~/.ssh/id_rsa
  38. ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts
  39. git config --global user.email "[email protected]"
  40. git config --global user.name "opencode"
  41. - name: Publish
  42. run: |
  43. bun install
  44. if [ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]; then
  45. ./script/publish.ts
  46. else
  47. ./script/publish.ts --snapshot
  48. fi
  49. working-directory: ./packages/opencode
  50. env:
  51. GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
  52. AUR_KEY: ${{ secrets.AUR_KEY }}
  53. NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}