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

76 lines
1.9 KiB
YAML
Raw Normal View History

2024-07-20 22:32:37 +02:00
name: Build all NixOS Configurations
on:
2024-07-21 12:18:43 +02:00
- push
#schedule:
# - cron: "20 12 * * *" # not to frequent, GitHub only allows a few pulls per hour
2024-07-20 22:32:37 +02:00
2024-07-19 19:00:35 +02:00
jobs:
2024-07-21 12:15:56 +02:00
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:15:56 +02:00
- name: checkout repository
uses: actions/checkout@v2
with:
depth: 0
2024-07-21 12:21:19 +02:00
- name: update nix flakes
#if: github.event_name == 'schedule'
2024-07-21 12:15:56 +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
- name: fetch and check
run: |
cat <<EOF > .ssh_key
${{ secrets.SSH_KEY }}
EOF
chmod 600 .ssh_key
eval $(ssh-agent)
ssh-add .ssh_key
nix flake archive
nix flake check --verbose --log-format raw
echo $SSH_AGENT_PID
kill $SSH_AGENT_PID
rm .ssh_key
- name: nix build orbi
run: nix build .#nixosConfigurations.orbi.config.system.build.toplevel
- name: nix build cream
run: nix build .#nixosConfigurations.cream.config.system.build.toplevel
- 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
- name: push if all fine (branch update)
2024-07-21 12:21:19 +02:00
#if: github.event_name == 'schedule'
2024-07-21 12:15:56 +02:00
run: |
git config --local user.email "action@git.ingolf-wagner.de"
git config --local user.name "Forgejo Action"
git diff --quiet && \
git diff --staged --quiet || \
(git commit -am "Update Nix flakes" && git push)