|
| 1 | +name: tui-release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "tui-v*" |
| 7 | + - "v*" |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-binaries: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: ubuntu-latest |
| 20 | + asset_name: cable-intel-tui-linux-x64 |
| 21 | + exec_name: cable-intel-tui-linux-x64 |
| 22 | + shell: bash |
| 23 | + - os: macos-13 |
| 24 | + asset_name: cable-intel-tui-macos-x64 |
| 25 | + exec_name: cable-intel-tui-macos-x64 |
| 26 | + shell: bash |
| 27 | + - os: macos-14 |
| 28 | + asset_name: cable-intel-tui-macos-arm64 |
| 29 | + exec_name: cable-intel-tui-macos-arm64 |
| 30 | + shell: bash |
| 31 | + - os: windows-latest |
| 32 | + asset_name: cable-intel-tui-windows-x64.exe |
| 33 | + exec_name: cable-intel-tui-windows-x64.exe |
| 34 | + shell: pwsh |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Setup Bun |
| 41 | + uses: oven-sh/setup-bun@v2 |
| 42 | + with: |
| 43 | + bun-version: 1.3.8 |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + run: bun install --frozen-lockfile |
| 47 | + shell: ${{ matrix.shell }} |
| 48 | + |
| 49 | + - name: Build + smoke test (unix) |
| 50 | + if: matrix.shell == 'bash' |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + set -euo pipefail |
| 54 | + mkdir -p apps/tui/dist |
| 55 | + bun build apps/tui/src/index.tsx --compile --outfile "apps/tui/dist/${{ matrix.exec_name }}" |
| 56 | + "./apps/tui/dist/${{ matrix.exec_name }}" --help |
| 57 | + shasum -a 256 "apps/tui/dist/${{ matrix.exec_name }}" > "apps/tui/dist/${{ matrix.exec_name }}.sha256" |
| 58 | +
|
| 59 | + - name: Build + smoke test (windows) |
| 60 | + if: matrix.shell == 'pwsh' |
| 61 | + shell: pwsh |
| 62 | + run: | |
| 63 | + New-Item -ItemType Directory -Force -Path apps/tui/dist | Out-Null |
| 64 | + bun build apps/tui/src/index.tsx --compile --outfile "apps/tui/dist/${{ matrix.exec_name }}" |
| 65 | + & "apps/tui/dist/${{ matrix.exec_name }}" --help |
| 66 | + $hash = (Get-FileHash -Path "apps/tui/dist/${{ matrix.exec_name }}" -Algorithm SHA256).Hash.ToLower() |
| 67 | + "$hash *${{ matrix.exec_name }}" | Set-Content "apps/tui/dist/${{ matrix.exec_name }}.sha256" |
| 68 | +
|
| 69 | + - name: Upload binary artifact |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: ${{ matrix.asset_name }} |
| 73 | + path: | |
| 74 | + apps/tui/dist/${{ matrix.exec_name }} |
| 75 | + apps/tui/dist/${{ matrix.exec_name }}.sha256 |
| 76 | + if-no-files-found: error |
| 77 | + |
| 78 | + publish-release: |
| 79 | + if: startsWith(github.ref, 'refs/tags/') |
| 80 | + needs: build-binaries |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - name: Download artifacts |
| 84 | + uses: actions/download-artifact@v4 |
| 85 | + with: |
| 86 | + path: release-assets |
| 87 | + merge-multiple: true |
| 88 | + |
| 89 | + - name: Publish release assets |
| 90 | + uses: softprops/action-gh-release@v2 |
| 91 | + with: |
| 92 | + tag_name: ${{ github.ref_name }} |
| 93 | + generate_release_notes: true |
| 94 | + files: release-assets/* |
0 commit comments