nixos-config/.forgejo/workflows/nix_build.yaml

69 lines
2.2 KiB
YAML
Raw Normal View History

2024-07-20 22:32:37 +02:00
name: Build all NixOS Configurations
on:
2024-07-21 12:27:57 +02:00
push:
branches:
2024-07-22 00:18:48 +02:00
- "**"
2024-07-21 12:29:29 +02:00
schedule:
2024-08-22 22:14:58 +02:00
- cron: "30 2/6 * * *" # not to frequent, GitHub only allows a few pulls per hour
2024-07-19 19:00:35 +02:00
jobs:
2024-07-20 22:32:37 +02:00
nix build:
2024-07-19 19:00:35 +02:00
runs-on: native
steps:
2024-07-21 12:24:00 +02:00
- uses: actions/checkout@v4
with:
clean: true
2024-07-21 12:32:04 +02:00
- name: update nix flakes
if: ${{ github.event_name == 'schedule' }}
2024-07-21 13:07:09 +02:00
# we need to use our ssh key here because we need access to private flakes
2024-07-21 12:32:04 +02:00
run: |
cat <<EOF > .ssh_key
${{ secrets.SSH_KEY }}
EOF
chmod 600 .ssh_key
eval $(ssh-agent)
ssh-add .ssh_key
nix flake update
echo $SSH_AGENT_PID
kill $SSH_AGENT_PID
rm .ssh_key
2024-07-21 13:07:09 +02:00
- name: nix flake archive/check
# we need to use our ssh key here because we need access to private flakes
2024-07-21 12:15:56 +02:00
run: |
2024-07-21 12:42:35 +02:00
cat <<EOF > .ssh_key
2024-07-21 12:15:56 +02:00
${{ secrets.SSH_KEY }}
EOF
2024-07-21 12:42:35 +02:00
chmod 600 .ssh_key
2024-07-21 12:15:56 +02:00
eval $(ssh-agent)
2024-07-21 12:42:35 +02:00
ssh-add .ssh_key
2024-07-21 12:15:56 +02:00
2024-07-21 12:26:11 +02:00
nix flake archive
2024-07-21 12:33:53 +02:00
nix flake check --verbose --log-format raw
2024-07-21 12:15:56 +02:00
echo $SSH_AGENT_PID
kill $SSH_AGENT_PID
2024-07-21 12:42:35 +02:00
rm .ssh_key
2024-07-21 12:33:53 +02:00
- name: nix build orbi
run: nix build .#nixosConfigurations.orbi.config.system.build.toplevel
2024-09-22 05:50:50 +02:00
# - name: nix build cream
# run: nix build .#nixosConfigurations.cream.config.system.build.toplevel
2024-07-21 12:33:53 +02:00
- name: nix build cherry
run: nix build .#nixosConfigurations.cherry.config.system.build.toplevel
- name: nix build chungus
run: nix build .#nixosConfigurations.chungus.config.system.build.toplevel
2024-08-09 16:07:11 +02:00
- name: nix build usbstick
run: nix build .#nixosConfigurations.usbstick.config.system.build.toplevel
2024-07-21 13:07:09 +02:00
- name: commit & push
2024-07-21 12:36:44 +02:00
if: ${{ github.event_name == 'schedule' }}
2024-07-21 13:07:09 +02:00
# only if all nix builds are fine we update our branch
2024-07-21 12:36:44 +02:00
run: |
git config --local user.email "action@git.ingolf-wagner.de"
2024-07-21 12:43:38 +02:00
git config --local user.name "Forgejo Action :robot:"
2024-07-21 12:36:44 +02:00
git diff --quiet && \
git diff --staged --quiet || \
2024-07-21 12:43:38 +02:00
(git commit -am ":arrow_up: nix flake update" && git push)