Update flake #27
This file contains 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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Update flake | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 1 * *" | |
- cron: "0 4 15 * *" | |
jobs: | |
nvfetcher_matrix: | |
name: Generate nvfetcher update matrix | |
runs-on: ubuntu-latest | |
outputs: | |
paths: ${{ steps.matrix.outputs.paths }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install nix | |
uses: ./.github/actions/install-nix | |
- name: Generate matrix | |
id: matrix | |
run: | | |
set -ex | |
nix profile install .#jq .#fd | |
paths="$(fd 'nvfetcher.toml|sources.toml' | jq -ncR '[inputs]')" | |
echo "paths=$paths" >> $GITHUB_OUTPUT | |
nvfetcher_update: | |
runs-on: ubuntu-latest | |
needs: [nvfetcher_matrix] | |
if: ${{ needs.nvfetcher_matrix.outputs.paths != '[]' && needs.nvfetcher_matrix.outputs.paths != '' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
path: ${{ fromJson(needs.nvfetcher_matrix.outputs.paths )}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install nix | |
uses: ./.github/actions/install-nix | |
- name: Update element | |
run: | | |
nix run .#nvfetcher -- \ | |
--build-dir $(dirname ${{ matrix.path }}) \ | |
--config ${{ matrix.path }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: '${{ secrets.PAT }}' | |
title: 'ci: bump ${{ matrix.path }}' | |
commit-message: | | |
Bump ${{ matrix.path }} | |
Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
author: GitHub <[email protected]> | |
branch: update/${{ matrix.path }} | |
delete-branch: true | |
main: | |
name: Update flake inputs | |
runs-on: ubuntu-latest | |
outputs: | |
paths: ${{ steps.matrix.outputs.paths }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install nix | |
uses: ./.github/actions/install-nix | |
- name: Update flake.toml | |
run: nix run .#nvfetcher -- -o flake -c flake/flake.toml | |
- name: Rebuild flake.nix | |
run: nix run github:viperML/dotfiles#dotci -- gen-flake -t flake/flake.nix.hbs -n flake/generated.json > flake.nix | |
- name: Update flake.lock | |
run: nix flake update | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: '${{ secrets.PAT }}' | |
title: 'ci: bump flake' | |
commit-message: | | |
Bump flake | |
Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
author: GitHub <[email protected]> | |
branch: update/flake | |
delete-branch: true |