infrastructure/.github/workflows/ci.yml

46 lines
1.2 KiB
YAML

name: CI
on:
push:
defaults:
run:
shell: nix develop --command bash -c "{0}"
env:
CACHE_NAME: qois
CACHE_REPOSITORY: qois:qois-infrastructure
jobs:
build:
runs-on: nix
steps:
- name: Initialize CI
uses: https://git.qo.is/qo.is/actions-nix-init@main
with:
token: ${{ secrets.CI_TOKEN }}
lfs: false
- name: Setup Attic Cache
env:
SERVER: https://attic.qo.is/
ATTIC_AUTH_TOKEN: ${{ secrets.ATTIC_AUTH_TOKEN }}
run: |
attic login "$CACHE_NAME" "$SERVER" "$ATTIC_AUTH_TOKEN"
attic use "$CACHE_REPOSITORY"
- name: Run Builds and Checks
run: nix-fast-build --no-nom --max-jobs 6 --skip-cached --attic-cache "$CACHE_REPOSITORY"
deploy:
needs: build
if: success() && github.ref == 'refs/heads/main'
runs-on: nix
env:
SSH_DEPLOY_KEY: "${{ secrets.SSH_DEPLOY_KEY }}"
strategy:
matrix:
profile:
- docs-ops.qo.is
- system-vm
steps:
- name: Initialize CI
uses: https://git.qo.is/qo.is/actions-nix-init@main
with:
token: ${{ secrets.CI_TOKEN }}
lfs: false
- name: "Deploy profile"
run: "auto-deploy ${{ matrix.profile }}"