Flake Update #912
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Flake Update | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| env: | |
| commit: ':robot::snowflake: flake.lock : update' | |
| pr_title: ':robot::snowflake: update flake lock ' | |
| pr_assignee: 'MadMcCrow' | |
| pr_message: ':robot: github action on $(date -I)' | |
| jobs: | |
| # generate JSONs for future builds and checks | |
| generate_matrix: | |
| runs-on: ubuntu-20.04 | |
| outputs: | |
| configurations: ${{ steps.gen_configs.outputs.configurations }} | |
| steps : | |
| - uses: actions/checkout@v3 | |
| - name: setup-nix | |
| uses: ./.github/actions/setup-nix | |
| - name: Generate flake.json | |
| run: | | |
| nix flake show --json > flake.json | |
| - id: gen_configs | |
| run: | | |
| configurations=$(jq -c '.nixosConfigurations | keys' < flake.json) | |
| echo "configurations=$configurations" >> $GITHUB_OUTPUT | |
| # update flake inputs | |
| update_flake: | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: setup-nix | |
| uses: ./.github/actions/setup-nix | |
| - name: Update the flake | |
| run: nix flake update | |
| - name: Store flake.lock | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: flake-lock | |
| path: flake.lock | |
| # build new flake | |
| build_flake: | |
| runs-on: ubuntu-20.04 | |
| needs: [generate_matrix, update_flake] | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 5 | |
| matrix: | |
| config: ${{fromJson(needs.generate_matrix.outputs.configurations)}} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: setup-nix | |
| uses: ./.github/actions/setup-nix | |
| - name: Set up cachix | |
| uses: cachix/cachix-action@v11 | |
| with: | |
| name: nixos-configuration | |
| signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" | |
| pathsToPush: result | |
| - name: Restore flake.lock | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: flake-lock | |
| - name: Build everything | |
| run: | | |
| nix build .#nixosConfigurations.${{ matrix.config }}.config.system.build.toplevel | |
| # check the flake itself | |
| check_flake: | |
| runs-on: ubuntu-20.04 | |
| needs: [update_flake] | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: setup-nix | |
| uses: ./.github/actions/setup-nix | |
| - name: Restore flake.lock | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: flake-lock | |
| - name: Check everything | |
| run: | | |
| nix flake check --keep-going | |
| # Create pull request | |
| push_update: | |
| runs-on: ubuntu-20.04 | |
| permissions: write-all | |
| needs: [update_flake, build_flake, check_flake] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Restore flake.lock | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: flake-lock | |
| - name: Set up git | |
| run: | | |
| git config user.email gnoe.perard+git@gmail.com | |
| git config user.name "Git Bot" | |
| - id: pull-request | |
| run: | | |
| git switch -c updates-${{ github.run_id }} | |
| git commit -am "Automated : Flake update" | |
| git push -u origin updates-${{ github.run_id }} | |
| PR=$(gh pr create \ | |
| --assignee MadMcCrow \ | |
| --base main \ | |
| --body "Automated Flake update by Github Action" \ | |
| --fill \ | |
| --label bot \ | |
| --title "Auto update $(date -I)") | |
| gh pr merge $PR --merge --delete-branch | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| shell: bash |