Flake Update #26
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
name: "Flake Update" | |
on: | |
schedule: | |
- cron: '30 16 * * 6' | |
workflow_dispatch: | |
jobs: | |
build-system: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Substituters | |
id: substituters | |
run: | | |
echo "TRUSTED_PUBLIC_KEYS=$(./nix.sh ci_get trusted-public-keys)" >> "$GITHUB_OUTPUT" | |
echo "SUBSTITUTERS=$(./nix.sh ci_get trusted-substituters)" >> "$GITHUB_OUTPUT" | |
- name: "Install Nix" | |
uses: cachix/install-nix-action@v26 | |
with: | |
extra_nix_config: | | |
trusted-public-keys = ${{ steps.substituters.outputs.TRUSTED_PUBLIC_KEYS }} | |
substituters = ${{ steps.substituters.outputs.SUBSTITUTERS }} | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: "Update flake.lock and nvfetcher" | |
run: | | |
nix --accept-flake-config --show-trace --print-build-logs --verbose flake update 2>&1 | tee flake-update.txt | |
nix develop .#ci --command bash -c nvfetcher 2>&1 | tee nvfetcher-update.txt | |
- name: "Write changelog" | |
id: changelog | |
run: | | |
echo "commit_msg=$(echo "chore: update flake.lock & sources ($(date -I))")" >> "$GITHUB_OUTPUT" | |
echo "date_week=$(date +%V)" >> "$GITHUB_OUTPUT" | |
echo "date_year=$(date +%Y)" >> "$GITHUB_OUTPUT" | |
echo "body_file=$PWD/changelog.txt" >> "$GITHUB_OUTPUT" | |
echo "Automated Pull Request for Week $(date +%V)" > changelog.txt | |
echo "" >> changelog.txt | |
echo "Flakes Changelog:" >> changelog.txt | |
echo "\`\`\`" >> changelog.txt | |
(grep -E "'\s\(|Updated input" flake-update.txt || echo "No changes!") >> changelog.txt | |
echo "\`\`\`" >> changelog.txt | |
echo "" >> changelog.txt | |
echo "Sources Changelog:" >> changelog.txt | |
echo "\`\`\`" >> changelog.txt | |
(grep -E "→" nvfetcher-update.txt || echo "No changes!") >> changelog.txt | |
echo "\`\`\`" >> changelog.txt | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
title: ${{ steps.changelog.outputs.commit_msg }} | |
token: ${{ secrets.PR_CREATOR }} | |
commit-message: ${{ steps.changelog.outputs.commit_msg }} | |
add-paths: | | |
_sources/* | |
flake.lock | |
signoff: true | |
delete-branch: true | |
branch: flake-update/${{ steps.changelog.outputs.date_year }}-${{ steps.changelog.outputs.date_week }} | |
body-path: ${{ steps.changelog.outputs.body_file }} |