diff --git a/.gitea/workflows/build-after-flake-update.yml b/.gitea/workflows/build-after-flake-update.yml new file mode 100644 index 0000000..71c55f7 --- /dev/null +++ b/.gitea/workflows/build-after-flake-update.yml @@ -0,0 +1,29 @@ +name: Build (nix) + +on: + workflow_run: + workflows: + - Update flake lock + types: + - completed + +permissions: + contents: read + +jobs: + build: + if: ${{ gitea.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + # The update workflow may have pushed a newer flake.lock commit. + ref: ${{ gitea.event.workflow_run.head_branch }} + + - name: Install upstream Nix + uses: cachix/install-nix-action@v31 + + - name: Build flake + run: nix build diff --git a/.gitea/workflows/update-flake-lock.yml b/.gitea/workflows/update-flake-lock.yml new file mode 100644 index 0000000..5509aba --- /dev/null +++ b/.gitea/workflows/update-flake-lock.yml @@ -0,0 +1,40 @@ +name: Update flake lock + +on: + schedule: + # Gitea cron schedules use UTC. 07:00 UTC is 03:00 EDT. + - cron: "0 7 * * 0" + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-flake-lock: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install upstream Nix + uses: cachix/install-nix-action@v31 + + - name: Update flake lock + run: nix flake update + + - name: Commit and push changes + shell: bash + run: | + set -euo pipefail + + if git diff --quiet -- flake.lock; then + echo "flake.lock is already up to date" + exit 0 + fi + + git config user.name "gitea-actions[bot]" + git config user.email "gitea-actions[bot]@noreply.localhost" + git add flake.lock + git commit -m "chore: update flake lock" + git push