move to new flake eval scripts #31
44
.github/workflows/flake-update.yml
vendored
44
.github/workflows/flake-update.yml
vendored
@ -7,7 +7,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
createPullRequest:
|
createPullRequest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# if: github.ref == 'refs/heads/main' # ensure workflow_dispatch only runs on main
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
# - name: Login to Docker Hub
|
# - name: Login to Docker Hub
|
||||||
@ -21,13 +20,6 @@ jobs:
|
|||||||
extra_nix_config: |
|
extra_nix_config: |
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
install_url: https://releases.nixos.org/nix/nix-2.19.0/install
|
install_url: https://releases.nixos.org/nix/nix-2.19.0/install
|
||||||
- name: Setup Attic cache
|
|
||||||
uses: ryanccn/attic-action@v0
|
|
||||||
with:
|
|
||||||
endpoint: ${{ secrets.ATTIC_ENDPOINT }}
|
|
||||||
cache: ${{ secrets.ATTIC_CACHE }}
|
|
||||||
token: ${{ secrets.ATTIC_TOKEN }}
|
|
||||||
skip-push: "true"
|
|
||||||
- name: Calculate pre-drv
|
- name: Calculate pre-drv
|
||||||
run: nix run git+https://nayeonie.com/ahuston-0/flake-update-diff -- --build .
|
run: nix run git+https://nayeonie.com/ahuston-0/flake-update-diff -- --build .
|
||||||
# - name: Pull latest docker images
|
# - name: Pull latest docker images
|
||||||
@ -70,12 +62,21 @@ jobs:
|
|||||||
# automated
|
# automated
|
||||||
update_lockfile:
|
update_lockfile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref == 'refs/heads/main' # ensure workflow_dispatch only runs on main
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: https://github.com/DeterminateSystems/nix-installer-action@main
|
uses: https://github.com/DeterminateSystems/nix-installer-action@main
|
||||||
|
- name: Setup Attic cache
|
||||||
|
uses: ryanccn/attic-action@v0
|
||||||
|
with:
|
||||||
|
endpoint: ${{ secrets.ATTIC_ENDPOINT }}
|
||||||
|
cache: ${{ secrets.ATTIC_CACHE }}
|
||||||
|
token: ${{ secrets.ATTIC_TOKEN }}
|
||||||
|
skip-push: "true"
|
||||||
|
- name: Get pre-snapshot of evaluations
|
||||||
|
run: nix ./utils/eval-to-drv.sh pre
|
||||||
- name: Update flake.lock
|
- name: Update flake.lock
|
||||||
id: update
|
id: update
|
||||||
run: |
|
run: |
|
||||||
@ -90,7 +91,18 @@ jobs:
|
|||||||
echo "EOF" >> $GITHUB_ENV
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
|
||||||
rm update.log
|
rm update.log
|
||||||
|
- name: Get post-snapshot of evaluations
|
||||||
|
run: nix ./utils/eval-to-drv.sh post
|
||||||
|
- name: Calculate diff
|
||||||
|
run: nix ./utils/diff-evals.sh
|
||||||
|
- name: Read diff into environment
|
||||||
|
run: |
|
||||||
|
delimiter="$(openssl rand -hex 8)"
|
||||||
|
{
|
||||||
|
echo "POSTDIFF<<${delimiter}"
|
||||||
|
cat post-diff
|
||||||
|
echo "${delimiter}"
|
||||||
|
} >> $GITHUB_ENV
|
||||||
- name: Write PR body template
|
- name: Write PR body template
|
||||||
uses: https://github.com/DamianReeves/write-file-action@v1.3
|
uses: https://github.com/DamianReeves/write-file-action@v1.3
|
||||||
with:
|
with:
|
||||||
@ -102,10 +114,14 @@ jobs:
|
|||||||
${{ env.UPDATE_LOG }}
|
${{ env.UPDATE_LOG }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ env.POSTDIFF }}
|
||||||
|
```
|
||||||
|
|
||||||
Auto-generated by [update.yml][1] with the help of
|
Auto-generated by [update.yml][1] with the help of
|
||||||
[create-pull-request][2].
|
[create-pull-request][2].
|
||||||
|
|
||||||
[1]: https://forgejo.stefka.eu/jiriks74/nix.nvim/src/branch/main/.github/workflows/update.yml
|
[1]: https://nayeonie.com/ahuston-0/nix-dotfiles/src/branch/main/.github/workflows/flake-update.yml
|
||||||
[2]: https://forgejo.stefka.eu/jiriks74/create-pull-request
|
[2]: https://forgejo.stefka.eu/jiriks74/create-pull-request
|
||||||
|
|
||||||
- name: Generate PR body
|
- name: Generate PR body
|
||||||
@ -123,6 +139,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rm pr_body.template
|
rm pr_body.template
|
||||||
rm pr_body.md
|
rm pr_body.md
|
||||||
|
rm pre.json
|
||||||
|
rm post.json
|
||||||
|
rm post-diff
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
id: create-pull-request
|
id: create-pull-request
|
||||||
@ -140,6 +159,9 @@ jobs:
|
|||||||
|
|
||||||
branch: update-flake-lock
|
branch: update-flake-lock
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
|
pr-labels: | # Labels to be set on the PR
|
||||||
|
dependencies
|
||||||
|
automated
|
||||||
- name: Push to Attic
|
- name: Push to Attic
|
||||||
run: nix ./utils/attic-push.bash
|
run: nix ./utils/attic-push.bash
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
@ -10,15 +10,4 @@ set -e
|
|||||||
script_path=$(dirname "$(readlink -f $0)")
|
script_path=$(dirname "$(readlink -f $0)")
|
||||||
parent_path=$(dirname "$script_path")
|
parent_path=$(dirname "$script_path")
|
||||||
|
|
||||||
readarray -t pre_drv < "$parent_path/pre-drv"
|
nix run git+https://nayeonie.com/ahuston-0/flake-update-diff -- --compare-drvs "$parent_path"
|
||||||
readarray -t post_drv < "$parent_path/post-drv"
|
|
||||||
|
|
||||||
post_drv_path="$parent_path/post-diff"
|
|
||||||
# cleanup any files with the same name
|
|
||||||
rm "$post_drv_path" || true
|
|
||||||
touch "$post_drv_path"
|
|
||||||
|
|
||||||
for i in $(seq 0 $(( "${#pre_drv[@]}" -1 ))); do
|
|
||||||
echo "Diffing updates to $(echo "${pre_drv[$i]}" | cut -f 2- -d '-')" >> "$post_drv_path"
|
|
||||||
nvd diff "${pre_drv[$i]}" "${post_drv[$i]}" >> "$post_drv_path"
|
|
||||||
done
|
|
||||||
|
@ -14,9 +14,6 @@ fi
|
|||||||
|
|
||||||
script_path=$(dirname "$(readlink -f $0)")
|
script_path=$(dirname "$(readlink -f $0)")
|
||||||
parent_path=$(dirname "$script_path")
|
parent_path=$(dirname "$script_path")
|
||||||
out_path="$parent_path/$1-drv"
|
out_path="$parent_path/$1.json"
|
||||||
|
|
||||||
|
nix run git+https://nayeonie.com/ahuston-0/flake-update-diff -- --evaluate --json "$out_path" "$parent_path"
|
||||||
drv=$(nix flake check --verbose 2> >(grep -P -o "derivation evaluated to (/nix/store/.*\.drv)" | grep -P -o "/nix/store/.*\.drv"))
|
|
||||||
|
|
||||||
echo "$drv" > "$out_path"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user