infrastructure/.github/workflows/ci.yml

66 lines
1.5 KiB
YAML

name: ci
on:
push:
branches:
- master
jobs:
test:
runs-on:
- ubuntu-latest
- nixos
- x86_64
container:
volumes:
- /mnt/cache/nix_store:/nix
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install sudo
run: apt update && apt install -y sudo
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
- name: Flake check
run: ls -lah / && nix flake check --impure
deploy:
runs-on:
- ubuntu-latest
- nixos
- x86_64
container:
volumes:
- /mnt/cache/nix_store:/nix
needs: test
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install sudo
run: apt update && apt install -y sudo
- name: Install Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
- name: Load ssh key
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy
run: nix develop --command deploy --rollback-succeeded false
env:
ACTION_RUNTIME_TOKEN: ''
GITHUB_TOKEN: ''