infrastructure/.github/workflows/ci.yml

66 lines
1.4 KiB
YAML
Raw Normal View History

2023-11-19 18:48:48 +00:00
name: ci
on:
push:
branches:
- master
jobs:
test:
2024-02-04 19:01:49 +00:00
runs-on:
- ubuntu-latest
- nixos
- x86_64
2023-11-19 18:51:56 +00:00
container:
volumes:
- /mnt/cache/nix_store:/nix
2023-11-19 18:48:48 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v4
2023-11-19 19:00:34 +00:00
- name: Install sudo
run: apt update && apt install -y sudo
2023-11-19 18:48:48 +00:00
- name: Install Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
2023-11-19 19:42:43 +00:00
github_access_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
2023-11-19 18:48:48 +00:00
- name: Flake check
2023-11-19 19:42:43 +00:00
run: nix flake check
2023-11-19 18:48:48 +00:00
deploy:
2024-02-04 19:01:49 +00:00
runs-on:
- ubuntu-latest
- nixos
- x86_64
2023-11-19 18:51:56 +00:00
container:
volumes:
- /mnt/cache/nix_store:/nix
2023-11-19 18:48:48 +00:00
needs: test
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v4
2023-11-19 19:00:34 +00:00
- name: Install sudo
run: apt update && apt install -y sudo
2023-11-19 18:48:48 +00:00
- name: Install Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
2023-11-19 19:42:43 +00:00
github_access_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
2023-11-19 18:48:48 +00:00
- 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
2023-11-19 19:07:00 +00:00
env:
ACTION_RUNTIME_TOKEN: ''
GITHUB_TOKEN: ''