|
| 1 | +name: cli-build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + release: |
| 8 | + types: [published] |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + target: |
| 20 | + - bun-linux-x64 |
| 21 | + - bun-linux-x64-baseline |
| 22 | + - bun-linux-x64-modern |
| 23 | + - bun-linux-arm64 |
| 24 | + - bun-windows-x64 |
| 25 | + - bun-windows-x64-baseline |
| 26 | + - bun-windows-x64-modern |
| 27 | + - bun-windows-arm64 |
| 28 | + - bun-darwin-x64 |
| 29 | + - bun-darwin-arm64 |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - uses: oven-sh/setup-bun@v2 |
| 34 | + |
| 35 | + - run: bun install --frozen-lockfile |
| 36 | + |
| 37 | + - name: Compute artifact name |
| 38 | + id: artifact |
| 39 | + run: | |
| 40 | + short="${{ matrix.target }}" |
| 41 | + short="${short#bun-}" |
| 42 | + name="video-link-debugger-${short}" |
| 43 | + case "${{ matrix.target }}" in |
| 44 | + bun-windows-*) name="${name}.exe" ;; |
| 45 | + esac |
| 46 | + echo "name=$name" >> "$GITHUB_OUTPUT" |
| 47 | +
|
| 48 | + - name: Compile |
| 49 | + run: bun build --compile --target=${{ matrix.target }} ./src/index.ts --outfile "${{ steps.artifact.outputs.name }}" |
| 50 | + |
| 51 | + - uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: ${{ steps.artifact.outputs.name }} |
| 54 | + path: ${{ steps.artifact.outputs.name }} |
| 55 | + if-no-files-found: error |
| 56 | + retention-days: 7 |
| 57 | + |
| 58 | + release: |
| 59 | + needs: build |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/download-artifact@v4 |
| 63 | + with: |
| 64 | + path: dist |
| 65 | + merge-multiple: true |
| 66 | + |
| 67 | + - name: Create commit-hash prerelease |
| 68 | + if: github.event_name == 'push' |
| 69 | + env: |
| 70 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + run: | |
| 72 | + gh release create "${{ github.sha }}" \ |
| 73 | + --repo "${{ github.repository }}" \ |
| 74 | + --target "${{ github.sha }}" \ |
| 75 | + --title "${{ github.sha }}" \ |
| 76 | + --notes "Automated build for commit ${{ github.sha }}" \ |
| 77 | + --prerelease \ |
| 78 | + dist/* |
| 79 | +
|
| 80 | + - name: Upload to release-please release |
| 81 | + if: github.event_name == 'release' |
| 82 | + env: |
| 83 | + GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} |
| 84 | + run: | |
| 85 | + gh release upload "${{ github.event.release.tag_name }}" dist/* \ |
| 86 | + --repo "${{ github.repository }}" \ |
| 87 | + --clobber |
0 commit comments