feat(web): bootstrap admin API token from environment #23
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Binaries | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux-x64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| desktop_supported: true | |
| - name: linux-x64-musl | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| desktop_supported: false | |
| - name: linux-arm64 | |
| os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| desktop_supported: true | |
| - name: linux-armv7 | |
| os: ubuntu-latest | |
| target: armv7-unknown-linux-gnueabihf | |
| desktop_supported: false | |
| - name: macos-arm64 | |
| os: macos-14 | |
| target: aarch64-apple-darwin | |
| desktop_supported: true | |
| - name: windows-x64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| desktop_supported: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Add Rust target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install ARMv7 linker | |
| if: matrix.target == 'armv7-unknown-linux-gnueabihf' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-arm-linux-gnueabihf | |
| - name: Install musl toolchain | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Install Linux desktop dependencies | |
| if: runner.os == 'Linux' && matrix.desktop_supported | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| libjavascriptcoregtk-4.1-dev \ | |
| libappindicator3-dev \ | |
| librsvg2-dev \ | |
| patchelf \ | |
| libssl-dev \ | |
| pkg-config \ | |
| build-essential \ | |
| curl \ | |
| wget \ | |
| file \ | |
| libxdo-dev \ | |
| libgtk-3-dev | |
| - name: Build release binary (Unix) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ "${{ matrix.target }}" = "armv7-unknown-linux-gnueabihf" ]; then | |
| export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc | |
| elif [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then | |
| export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc | |
| fi | |
| cargo build --release --target "${{ matrix.target }}" -p spuc-cli --bins | |
| if [ "${{ matrix.desktop_supported }}" = "true" ]; then | |
| cargo build --release --target "${{ matrix.target }}" -p spuc-gui | |
| fi | |
| - name: Build release binary (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} -p spuc-cli --bins | |
| if ("${{ matrix.desktop_supported }}" -eq "true") { | |
| cargo build --release --target ${{ matrix.target }} -p spuc-gui | |
| } | |
| - name: Package (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| id: package_unix | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| VERSION="$(awk -F'\"' '/^version[[:space:]]*=/{print $2; exit}' Cargo.toml)" | |
| OUT="spuc-v${VERSION}-${{ matrix.target }}" | |
| mkdir -p "dist/${OUT}" | |
| cp "target/${{ matrix.target }}/release/spuc" "dist/${OUT}/" | |
| cp "target/${{ matrix.target }}/release/spuc-agent" "dist/${OUT}/" | |
| if [ "${{ matrix.desktop_supported }}" = "true" ]; then | |
| cp "target/${{ matrix.target }}/release/spuc-gui" "dist/${OUT}/" | |
| fi | |
| cp README.md LICENSE.md "dist/${OUT}/" | |
| tar -C dist -czf "dist/${OUT}.tar.gz" "${OUT}" | |
| echo "asset=dist/${OUT}.tar.gz" >> "${GITHUB_OUTPUT}" | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| id: package_windows | |
| shell: pwsh | |
| run: | | |
| $versionLine = Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"(.*)"' | Select-Object -First 1 | |
| $version = $versionLine.Matches[0].Groups[1].Value | |
| $out = "spuc-v$version-${{ matrix.target }}" | |
| New-Item -ItemType Directory -Force -Path "dist/$out" | Out-Null | |
| Copy-Item "target/${{ matrix.target }}/release/spuc.exe" "dist/$out/" | |
| Copy-Item "target/${{ matrix.target }}/release/spuc-agent.exe" "dist/$out/" | |
| if ("${{ matrix.desktop_supported }}" -eq "true") { | |
| Copy-Item "target/${{ matrix.target }}/release/spuc-gui.exe" "dist/$out/" | |
| } | |
| Copy-Item "README.md","LICENSE.md" "dist/$out/" | |
| Compress-Archive -Path "dist/$out/*" -DestinationPath "dist/$out.zip" -Force | |
| "asset=dist/$out.zip" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Upload artifact (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spuc-${{ matrix.name }} | |
| path: ${{ steps.package_unix.outputs.asset }} | |
| - name: Upload artifact (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spuc-${{ matrix.name }} | |
| path: ${{ steps.package_windows.outputs.asset }} | |
| publish: | |
| name: Publish GitHub Release | |
| needs: [build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Publish release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/**/* | |
| publish-container: | |
| name: Publish GHCR Container | |
| needs: [build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=tag | |
| type=raw,value=latest | |
| - name: Build and push container image | |
| id: build-push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| provenance: true | |
| sbom: true | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: ghcr.io/${{ github.repository }} | |
| subject-digest: ${{ steps.build-push.outputs.digest }} | |
| push-to-registry: true |