name: Build self-hosted HTTP Toolkit on: push: branches: [main] tags: ['v*'] pull_request: workflow_dispatch: permissions: contents: write # needed to publish releases on tags jobs: build: strategy: fail-fast: false matrix: include: - os: ubuntu-latest name: linux-x64 smoke: true - os: macos-latest # Apple Silicon runner (arm64) name: macos-arm64 smoke: true - os: windows-latest name: windows-x64 smoke: false # background-process smoke is unix-only; --help still runs runs-on: ${{ matrix.os }} steps: - name: Checkout (with submodules) uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Setup Node uses: actions/setup-node@v4 with: node-version: 22 - name: Setup Bun uses: oven-sh/setup-bun@v2 with: bun-version: latest - name: Build shell: bash env: OUT_NAME: httptoolkit run: bash scripts/build.sh - name: Smoke test (unix) if: matrix.smoke shell: bash run: bash scripts/smoke.sh dist/httptoolkit - name: Windows sanity (--help) if: matrix.os == 'windows-latest' shell: bash run: ./dist/httptoolkit.exe --help - name: Stage artifact shell: bash run: | mkdir -p out if [ "${{ matrix.os }}" = "windows-latest" ]; then cp dist/httptoolkit.exe "out/httptoolkit-${{ matrix.name }}.exe" else cp dist/httptoolkit "out/httptoolkit-${{ matrix.name }}" fi - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: httptoolkit-${{ matrix.name }} path: out/* release: # Publish a GitHub release only when a v* tag is pushed. if: startsWith(github.ref, 'refs/tags/v') needs: build runs-on: ubuntu-latest steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Publish release uses: softprops/action-gh-release@v2 with: files: artifacts/**/* generate_release_notes: true