|
| 1 | +# Bun Compile |
| 2 | +# Compiles Auggie CLI into self-contained native binaries using Bun, |
| 3 | +# pulling the pre-built @augmentcode/auggie package from npm. |
| 4 | + |
| 5 | +name: Bun Compile |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'npm package version (e.g. 0.17.0)' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + repository_dispatch: |
| 14 | + types: [npm-published] |
| 15 | + push: |
| 16 | + branches: |
| 17 | + - auggie-bun-compile-workflow |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + include: |
| 25 | + - target: bun-darwin-arm64 |
| 26 | + output: auggie-darwin-arm64 |
| 27 | + artifact: auggie-darwin-arm64 |
| 28 | + - target: bun-darwin-x64 |
| 29 | + output: auggie-darwin-x64 |
| 30 | + artifact: auggie-darwin-x64 |
| 31 | + - target: bun-linux-x64 |
| 32 | + output: auggie-linux-x64 |
| 33 | + artifact: auggie-linux-x64 |
| 34 | + - target: bun-windows-x64 |
| 35 | + output: auggie-windows-x64.exe |
| 36 | + artifact: auggie-windows-x64 |
| 37 | + permissions: |
| 38 | + contents: read |
| 39 | + steps: |
| 40 | + - name: Set up Bun |
| 41 | + uses: oven-sh/setup-bun@v2 |
| 42 | + |
| 43 | + - name: Install package |
| 44 | + env: |
| 45 | + VERSION: ${{ inputs.version || github.event.client_payload.version }} |
| 46 | + run: | |
| 47 | + if [ -z "$VERSION" ]; then |
| 48 | + echo "::error::No version provided. Supply via workflow_dispatch input or repository_dispatch payload." |
| 49 | + exit 1 |
| 50 | + fi |
| 51 | + bun install "@augmentcode/auggie@${VERSION}" |
| 52 | +
|
| 53 | + - name: Create entry point |
| 54 | + run: | |
| 55 | + echo 'await import("@augmentcode/auggie");' > augment.mjs |
| 56 | +
|
| 57 | + - name: Compile binary |
| 58 | + run: bun build augment.mjs --compile --target=${{ matrix.target }} --outfile=${{ matrix.output }} |
| 59 | + |
| 60 | + - name: Upload artifact |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: ${{ matrix.artifact }} |
| 64 | + path: ${{ matrix.output }} |
| 65 | + |
| 66 | + release: |
| 67 | + needs: build |
| 68 | + runs-on: ubuntu-latest |
| 69 | + permissions: |
| 70 | + contents: write |
| 71 | + steps: |
| 72 | + - name: Download all artifacts |
| 73 | + uses: actions/download-artifact@v4 |
| 74 | + with: |
| 75 | + path: artifacts |
| 76 | + merge-multiple: true |
| 77 | + |
| 78 | + - name: Create GitHub Release |
| 79 | + env: |
| 80 | + GH_TOKEN: ${{ github.token }} |
| 81 | + GH_REPO: ${{ github.repository }} |
| 82 | + VERSION: ${{ inputs.version || github.event.client_payload.version }} |
| 83 | + run: | |
| 84 | + if [ -z "$VERSION" ]; then |
| 85 | + echo "::error::No version provided. Cannot create release." |
| 86 | + exit 1 |
| 87 | + fi |
| 88 | + gh release create "v${VERSION}" \ |
| 89 | + --title "v${VERSION}" \ |
| 90 | + --generate-notes \ |
| 91 | + artifacts/* |
| 92 | +
|
0 commit comments