Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add deploy workflow #208

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: CI

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
secrets:
CACHIX_AUTH_TOKEN:
required: false

jobs:
eval:
Expand All @@ -20,17 +22,16 @@ jobs:
uses: nixbuild/nix-quick-install-action@v26

- name: setup cachix
uses: cachix/cachix-action@master
uses: cachix/cachix-action@v12
with:
name: getchoo
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
skipAddingSubstituter: 'true'

- name: generate matrix
id: generate
run: |
set -Eeu
echo "matrix=$(nix eval --accept-flake-config --show-trace --json .#githubWorkflow.matrix)" >> "$GITHUB_OUTPUT"
echo "matrix=$(nix eval --show-trace --json .#githubWorkflow.matrix)" >> "$GITHUB_OUTPUT"

build:
needs: eval
Expand Down Expand Up @@ -63,14 +64,13 @@ jobs:
extra-conf: "extra-platforms = aarch64-linux arm-linux"

- name: setup cachix
uses: cachix/cachix-action@master
uses: cachix/cachix-action@v12
with:
name: getchoo
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
skipAddingSubstituter: 'true'

- name: build ${{ matrix.attr }}
run: nix build -L --accept-flake-config --fallback .#${{ matrix.attr }}
run: nix build -L --fallback .#${{ matrix.attr }}

check:
strategy:
Expand All @@ -87,14 +87,13 @@ jobs:
uses: DeterminateSystems/nix-installer-action@v7

- name: setup cachix
uses: cachix/cachix-action@master
uses: cachix/cachix-action@v12
with:
name: getchoo
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
skipAddingSubstituter: 'true'

- name: run check
run: nix flake check --accept-flake-config --show-trace
run: nix flake check --show-trace

# https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
gate:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: deploy systems

on:
push:
branches: [main]
workflow_dispatch:

jobs:
ci:
uses: ${{ github.repository }}/.github/workflows/ci.yaml@main
with:
secrets: inherit

deploy:
needs: ci
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: install nix
uses: nixbuild/nix-quick-install-action@v26

- name: setup cachix
uses: cachix/cachix-action@v12
with:
name: getchoo
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: connect to tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:gha

- name: enter dev shell
run: nix develop

- name: deploy all systems
run: just da