release #244
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version' | |
| required: true | |
| type: string | |
| latest: | |
| description: 'Latest' | |
| required: true | |
| type: boolean | |
| default: true | |
| reuse_engine_version: | |
| description: 'Reuse engine artifacts from this version (skips building)' | |
| required: false | |
| type: string | |
| defaults: | |
| run: | |
| # Enable fail-fast behavior | |
| shell: bash -e {0} | |
| env: | |
| # Disable incremental compilation for faster from-scratch builds | |
| CARGO_INCREMENTAL: 0 | |
| RUSTFLAGS: "--cfg tokio_unstable" | |
| jobs: | |
| setup: | |
| name: "Setup" | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| # Allow pushing to GitHub | |
| contents: write | |
| # Allows JSR to authenticate with GitHub | |
| id-token: write | |
| steps: | |
| - name: Checkout rivet | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: 'true' | |
| path: './rivet' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: corepack enable | |
| - name: Setup | |
| env: | |
| # https://docs.github.com/en/actions/security-guides/automatic-token-authentication | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }} | |
| R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }} | |
| working-directory: './rivet' | |
| run: | | |
| # Configure Git | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| # Authenticate with NPM | |
| cat << EOF > ~/.npmrc | |
| //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | |
| EOF | |
| # Install dependencies | |
| pnpm install | |
| # Install tsx globally | |
| npm install -g tsx | |
| # Build command based on inputs | |
| CMD="./scripts/release/main.ts --version \"${{ github.event.inputs.version }}\" --phase setup-ci" | |
| if [ "${{ inputs.latest }}" != "true" ]; then | |
| CMD="$CMD --no-latest" | |
| fi | |
| if [ -n "${{ inputs.reuse_engine_version }}" ]; then | |
| CMD="$CMD --reuse-engine-version \"${{ inputs.reuse_engine_version }}\"" | |
| fi | |
| eval "$CMD" | |
| binaries: | |
| name: "Build & Push Binaries" | |
| needs: [setup] | |
| if: ${{ !inputs.reuse_engine_version }} | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux | |
| runner: depot-ubuntu-24.04-8 | |
| target: x86_64-unknown-linux-musl | |
| binary_ext: "" | |
| arch: x86_64 | |
| # TODO: Add back when working | |
| # - platform: linux | |
| # runner: depot-ubuntu-24.04-arm-8 | |
| # target: aarch64-unknown-linux-musl | |
| # binary_ext: "" | |
| # arch: aarch64 | |
| - platform: windows | |
| runner: depot-ubuntu-24.04-8 | |
| target: x86_64-pc-windows-gnu | |
| binary_ext: ".exe" | |
| arch: x86_64 | |
| - platform: macos | |
| # Use Linux instead of macOS builders since macOS does not support Docker | |
| runner: depot-ubuntu-24.04-8 | |
| target: x86_64-apple-darwin | |
| binary_ext: "" | |
| arch: x86_64 | |
| - platform: macos | |
| # Use Linux instead of macOS builders since macOS does not support Docker | |
| runner: depot-ubuntu-24.04-8 | |
| target: aarch64-apple-darwin | |
| binary_ext: "" | |
| arch: aarch64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: 'true' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build using engine Dockerfile | |
| run: | | |
| # Use Docker BuildKit | |
| export DOCKER_BUILDKIT=1 | |
| # Build the binary using our Dockerfile | |
| engine/docker/engine/build.sh ${{ matrix.target }} | |
| # Make sure dist directory exists and binary is there | |
| ls -la dist/ | |
| - name: Upload artifacts | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }} | |
| run: | | |
| # Install dependencies for AWS CLI | |
| sudo apt-get update | |
| sudo apt-get install -y unzip curl | |
| # Install AWS CLI - use ARM version if running on ARM architecture | |
| if [ "${{ matrix.arch }}" = "aarch64" ]; then | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" | |
| else | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| fi | |
| unzip awscliv2.zip | |
| sudo ./aws/install --update | |
| COMMIT_SHA_SHORT="${GITHUB_SHA::7}" | |
| BINARY_PATH="dist/rivet-engine-${{ matrix.target }}${{ matrix.binary_ext }}" | |
| # Must specify --checksum-algorithm for compatibility with R2 | |
| aws s3 cp \ | |
| "${BINARY_PATH}" \ | |
| "s3://engine/${COMMIT_SHA_SHORT}/rivet-engine-${{ matrix.target }}${{ matrix.binary_ext }}" \ | |
| --region auto \ | |
| --endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com/rivet-releases \ | |
| --checksum-algorithm CRC32 | |
| docker: | |
| name: "Build & Push Docker Images" | |
| needs: [setup] | |
| if: ${{ !inputs.reuse_engine_version }} | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/arm64 | |
| runner: depot-ubuntu-24.04-arm-8 | |
| arch_suffix: -arm64 | |
| - platform: linux/x86_64 | |
| runner: depot-ubuntu-24.04-8 | |
| arch_suffix: -amd64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Setup Docker on macOS | |
| if: runner.os == 'macOS' | |
| uses: douglascamata/setup-docker-macos-action@v1-alpha | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Set outputs | |
| id: vars | |
| run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
| - uses: ./.github/actions/docker-setup | |
| with: | |
| docker_username: ${{ secrets.DOCKER_CI_USERNAME }} | |
| docker_password: ${{ secrets.DOCKER_CI_ACCESS_TOKEN }} | |
| github_token: ${{ secrets.GITHUB_TOKEN}} | |
| - name: Build & Push (rivetkit/engine:full) | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| tags: rivetkit/engine:full-${{ steps.vars.outputs.sha_short }}${{ matrix.arch_suffix }} | |
| file: engine/docker/universal/Dockerfile | |
| target: engine-full | |
| platforms: ${{ matrix.platform }} | |
| build-args: | | |
| BUILD_FRONTEND=true | |
| CARGO_BUILD_MODE=release | |
| # secrets: | | |
| # fontawesome_package_token=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} | |
| # secret-files: | | |
| # netrc=${{ runner.temp }}/netrc | |
| - name: Build & Push (rivetkit/engine:slim) | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| tags: rivetkit/engine:slim-${{ steps.vars.outputs.sha_short }}${{ matrix.arch_suffix }} | |
| file: engine/docker/universal/Dockerfile | |
| target: engine-slim | |
| platforms: ${{ matrix.platform }} | |
| build-args: | | |
| BUILD_FRONTEND=true | |
| CARGO_BUILD_MODE=release | |
| # secrets: | | |
| # fontawesome_package_token=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} | |
| # secret-files: | | |
| # netrc=${{ runner.temp }}/netrc | |
| complete: | |
| name: "Complete" | |
| needs: [setup, docker, binaries] | |
| if: ${{ always() && !cancelled() && needs.setup.result == 'success' && (needs.docker.result == 'success' || needs.docker.result == 'skipped') && (needs.binaries.result == 'success' || needs.binaries.result == 'skipped') }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: 'true' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: corepack enable | |
| - uses: ./.github/actions/docker-setup | |
| with: | |
| docker_username: ${{ secrets.DOCKER_CI_USERNAME }} | |
| docker_password: ${{ secrets.DOCKER_CI_ACCESS_TOKEN }} | |
| github_token: ${{ secrets.GITHUB_TOKEN}} | |
| - name: Complete | |
| env: | |
| # https://cli.github.com/manual/gh_help_environment | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }} | |
| R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }} | |
| run: | | |
| # Authenticate with NPM | |
| cat << EOF > ~/.npmrc | |
| //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | |
| EOF | |
| # Install dependencies | |
| pnpm install | |
| # Install tsx globally | |
| npm install -g tsx | |
| # Build command based on inputs | |
| CMD="./scripts/release/main.ts --version \"${{ github.event.inputs.version }}\" --phase complete-ci --no-validate-git" | |
| if [ "${{ inputs.latest }}" != "true" ]; then | |
| CMD="$CMD --no-latest" | |
| fi | |
| if [ -n "${{ inputs.reuse_engine_version }}" ]; then | |
| CMD="$CMD --reuse-engine-version \"${{ inputs.reuse_engine_version }}\"" | |
| fi | |
| eval "$CMD" |