Update CI #348
This file contains 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 | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Release version" | |
required: true | |
defaults: | |
run: | |
shell: nix develop -v -c bash {0} | |
jobs: | |
build: | |
name: Build | |
runs-on: [self-hosted, nix, general, "${{ matrix.arch.runner }}", small] | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- nix: x86_64-linux | |
runner: amd64-linux | |
- nix: aarch64-linux | |
runner: arm64-linux | |
- nix: aarch64-darwin | |
runner: arm64-darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set version | |
if: github.event.inputs.version | |
run: ./cli.sh set_version "${{ github.event.inputs.version }}" | |
- name: Build Dev Env | |
run: nix build -L -v --no-link '.#packages.${{ matrix.arch.nix }}.devEnv' | |
- name: Check | |
run: ./cli.sh code_quality | |
- name: Build | |
run: nix build -L -v --no-link '.#defaultPackage.${{ matrix.arch.nix }}' | |
- name: Cache Dev Env | |
env: | |
NIX_OUTPUT: .#packages.${{ matrix.arch.nix }}.devEnv | |
run: | | |
NIX_CACHE_SIGNING_PRIVATE_KEY_PATH=${NIX_CACHE_SIGNING_PRIVATE_KEY_PATH:?"NIX_CACHE_SIGNING_PRIVATE_KEY_PATH env var is not set"} | |
NIX_CACHE_BUCKET_NAME=${NIX_CACHE_BUCKET_NAME:?"NIX_CACHE_BUCKET_NAME env var is not set"} | |
NIX_CACHE_BUCKET_REGION=${NIX_CACHE_BUCKET_REGION:?"NIX_CACHE_BUCKET_REGION env var is not set"} | |
nix store sign "${NIX_OUTPUT}" -v -r -k "${NIX_CACHE_SIGNING_PRIVATE_KEY_PATH}" | |
nix copy -v --to "s3://${NIX_CACHE_BUCKET_NAME}/cache?region=${NIX_CACHE_BUCKET_REGION}&compression=zstd¶llel-compression=true" "${NIX_OUTPUT}" | |
- name: Cache helmet | |
env: | |
NIX_OUTPUT: .#defaultPackage.${{ matrix.arch.nix }} | |
run: | | |
nix store sign "${NIX_OUTPUT}" -v -r -k "${NIX_CACHE_SIGNING_PRIVATE_KEY_PATH}" | |
nix copy -v --to "s3://${NIX_CACHE_BUCKET_NAME}/cache?region=${NIX_CACHE_BUCKET_REGION}&compression=zstd¶llel-compression=true" "${NIX_OUTPUT}" | |
release: | |
name: Release ${{ github.event.inputs.version }} | |
if: github.event.inputs.version | |
needs: [build] | |
runs-on: [self-hosted, nix, general, amd64-linux, small] | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set version | |
if: github.event.inputs.version | |
run: ./cli.sh set_version "${{ github.event.inputs.version }}" | |
- name: Publish to JSR | |
if: github.event.inputs.version | |
run: ./cli.sh jsr_publish | |
- name: Release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./cli.sh create_release "${{ github.event.inputs.version }}" | |