-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up automatic deployments from main branch
- Loading branch information
Showing
6 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
name: Build flake outputs | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_call: | ||
|
||
jobs: | ||
discover: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Deploy NixOS systems | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
discover: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v25 | ||
- id: set-matrix | ||
name: Generate matrix | ||
run: | | ||
matrix=$( | ||
nix flake show --refresh --all-systems --json "." | | ||
jq ' | ||
path(.. | select(.type? == "nixos-configuration")) | last | { fqdn: . } | ||
' | | ||
jq --slurp --compact-output | ||
) | ||
echo "matrix=$matrix" >> "$GITHUB_OUTPUT" | ||
deploy: | ||
name: ${{ matrix.fqdn }} | ||
needs: discover | ||
runs-on: ubuntu-latest | ||
environment: live | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: ${{ fromJSON(needs.discover.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Write SSH keys | ||
run: | | ||
install -m 600 -D /dev/null ~/.ssh/deploy_key | ||
echo "${{ secrets.SSH_DEPLOY_KEY }}" > ~/.ssh/deploy_key | ||
cp ssh_known_hosts ~/.ssh/known_hosts | ||
- name: Deploy systems | ||
run: ssh root@${{ matrix.fqdn }} system-upgrade |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Build and deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-flake-outputs: | ||
uses: ./.github/workflows/build-flake-outputs.yml | ||
|
||
deploy-nixos-systems: | ||
needs: build-flake-outputs | ||
concurrency: live | ||
uses: ./.github/workflows/deploy-nixos-systems.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-flake-outputs: | ||
uses: ./.github/workflows/build-flake-outputs.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
users.users.root.openssh.authorizedKeys.keys = [ | ||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIByQhPnALCgo9Q4FbqYBCSTbMbP6OuSNmgRafdDo6yAx matrss@ipsmin" | ||
"command=\"system-upgrade\" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC60edKap3Qyp9AX1KJuGpZr72eA4KWSdn1Lg4GRzQfL GitHub Actions deploy" | ||
]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
hazuno.m.0px.xyz ssh-rsa AAAAB3NzaC1yc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