name: Sync flake lock with main nix-configuration project on: schedule: - cron: "15 3 * * *" workflow_dispatch: jobs: update: permissions: contents: write name: Sync flake lock with main nix-configuration project runs-on: ubuntu-latest outputs: changes: ${{ steps.checkChanges.outputs.CHANGES }} steps: - name: Checkout Repository uses: actions/checkout@v6 - name: Checkout nix-configuration repository uses: actions/checkout@v6 with: repository: xaked/nix-config path: nix-config ref: master token: ${{ secrets.NIX_CONFIGURATION_GITEA_CLONE_TOKEN }} - name: Check for update and perform update id: checkChanges run: | git config user.name gitea-bot git config user.email bot@git.palkoi.net git config --global user.email bot@git.palkoi.net git config --global user.name gitea-bot tmpfile="$(mktemp)" jq -srM '.[1].nodes.nixpkgs = .[0].nodes.nixpkgs_2|.[1].nodes.nixpkgs_2 = .[0].nodes.nixpkgs_2 | .[1]' ./nix-config/flake.lock flake.lock > "$tmpfile" cat "$tmpfile" > flake.lock git add flake.lock if [ -n "$(git diff --cached)" ]; then git diff --cached; echo 'CHANGES=y'>>$GITHUB_OUTPUT; else echo 'CHANGES=n'>>$GITHUB_OUTPUT; fi - name: Commit updates if: ${{ steps.checkChanges.outputs.CHANGES == 'y' }} run: | git commit --no-gpg-sign -m 'chore(flake): update flake.lock' git push build: name: Build flake if: ${{ needs.update.outputs.changes == 'y' }} needs: update uses: ./.gitea/workflows/build-flake.yml release: name: Release a new version needs: build uses: xaked/actions/.gitea/workflows/cog-release.yml@2.1.0 with: ref: ${{ github.ref_name }}