forgejo-ci-runners/.forgejo/workflows/build.yaml

52 lines
1.6 KiB
YAML
Raw Normal View History

2024-08-07 20:09:36 -05:00
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Build on PR"
2024-05-26 19:31:21 -05:00
on:
pull_request:
2024-08-07 20:09:36 -05:00
types: [opened, synchronize]
2024-07-25 08:25:40 -05:00
push:
branches: ["main"]
paths:
- .forgejo/workflows/build.yaml
2024-05-26 19:31:21 -05:00
jobs:
nix-build:
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
include:
2024-07-25 11:14:03 -05:00
- name: fj-hetzner-aarch64-01
system: aarch64-linux
2024-05-26 19:31:21 -05:00
os: native-aarch64
2024-07-25 11:14:03 -05:00
- name: fj-shadowfax-01
system: x86_64-linux
2024-05-26 19:31:21 -05:00
os: native-x86_64
runs-on: ${{ matrix.os }}
env:
PATH: ${{ format('{0}:{1}', '/run/current-system/sw/bin', env.PATH) }}
steps:
- name: Checkout repository
uses: https://github.com/actions/checkout@v4
with:
fetch-depth: 0
- uses: https://github.com/cachix/cachix-action@v15
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
name: hsndev
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Garbage collect build dependencies
run: nix-collect-garbage
2024-07-25 11:05:47 -05:00
- name: Build new ${{ matrix.system }} system and push to cachix
id: "build"
2024-05-26 19:31:21 -05:00
shell: bash
run: |
set -o pipefail
2024-07-25 11:45:44 -05:00
DRVOUT=$(nix build .#deploy-json.${{ matrix.system }} --print-out-paths)
2024-07-25 11:44:43 -05:00
echo "DRVOUT=$DRVOUT" >> $GITHUB_ENV
2024-07-25 11:14:03 -05:00
- name: Push cache for ${{ matrix.name }} to cachix
2024-07-25 11:05:47 -05:00
id: "push-to-cachix"
2024-05-26 19:31:21 -05:00
if: success()
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
2024-07-25 08:25:48 -05:00
run: |
2024-07-25 11:41:17 -05:00
echo $DRVOUT | cachix push hsndev