[nixos/server] fix warning #89
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: Deploy Server | |
permissions: read-all | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'nixos/server/**' | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
SSH_PRIVATE_KEY: | |
required: true | |
SSH_CONFIG: | |
required: true | |
KNOWN_HOSTS: | |
required: true | |
concurrency: | |
group: ${{ github.head_ref || github.ref }} | |
jobs: | |
deploy-server: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Setup ssh-agent | |
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0 | |
with: | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
name: id_rsa # optional | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
config: ${{ secrets.SSH_CONFIG }} # ssh_config; optional | |
if_key_exists: fail | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Install nix | |
uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # V30 | |
with: | |
nix_path: nixpkgs=channel:nixos-24.05 | |
- name: Use magix nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8 | |
- name: Check flake lock file | |
uses: DeterminateSystems/flake-checker-action@078f5f7f47ee188aa6cb472527ca5984e195222d # v9 | |
with: | |
flake-lock-path: nixos/server/flake.lock | |
- name: Run nixos-rebuild | |
uses: workflow/nix-shell-action@5fdff26c1325df635247f72cba79ffc370303fdb # v3.4.0 | |
with: | |
packages: nixos-rebuild | |
working-directory: nixos/server | |
script: | | |
sudo cp -r $HOME/.ssh /root | |
nixos-rebuild switch --fast --flake ".#nixos" --use-remote-sudo --target-host "[email protected]" --build-host "[email protected]" --builders "ssh://[email protected] aarch64-linux" || true | |
nixos-rebuild switch --fast --flake ".#nixos" --use-remote-sudo --target-host "[email protected]" --build-host "[email protected]" --builders '"ssh://[email protected] aarch64-linux"' |