This repository was archived by the owner on Oct 21, 2025. It is now read-only.
add versions to extensions #97
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: Build and Package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-binaries: | |
| name: Build Binaries | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| target: x86_64-unknown-linux-musl | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-musl | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install stable toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| override: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools pkg-config libssl-dev | |
| - name: Install Sentry CLI | |
| run: | | |
| curl -sL https://sentry.io/get-cli/ | bash | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: ${{ runner.os }}-${{ matrix.target }} | |
| - name: Build binary | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} | |
| sentry-cli --url ${{ secrets.SENTRY_URL }} debug-files upload --include-sources --org ${{ secrets.SENTRY_ORG }} --project ${{ secrets.SENTRY_PROJECT }} --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} target/${{ matrix.target }}/release/api | |
| strip target/${{ matrix.target }}/release/api | |
| mkdir -p dist/${{ matrix.arch }} | |
| cp target/${{ matrix.target }}/release/api dist/${{ matrix.arch }}/api | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-${{ matrix.arch }} | |
| path: dist/${{ matrix.arch }}/api | |
| retention-days: 1 | |
| create-multiarch-image: | |
| name: Create multi-arch Docker image | |
| needs: build-binaries | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all binary artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare binaries | |
| run: | | |
| chmod +x dist/api-amd64/api | |
| chmod +x dist/api-arm64/api | |
| mkdir -p .docker/amd64 .docker/arm64 | |
| cp dist/api-amd64/api .docker/amd64/api | |
| cp dist/api-arm64/api .docker/arm64/api | |
| cp entrypoint.sh .docker/ | |
| - name: Build and push multi-arch Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ghcr.io/blueprintframework/api:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |