mirror of
https://github.com/DeterminateSystems/update-flake-lock.git
synced 2025-04-20 17:00:16 +03:00
support updating multiple flake directories simultaneously
This is useful for monorepos containing multiple flakes. For example it might be desired for a nixpkgs update to happen on all sub-flakes at the same time. Added a new option `flake-dirs` allowing to specify multiple flake directories to be updated simultaneously via a single PR
This commit is contained in:
parent
a3ccb8f597
commit
81892d6fc9
3 changed files with 29 additions and 13 deletions
|
@ -135,7 +135,7 @@ jobs:
|
||||||
uses: DeterminateSystems/update-flake-lock@vX
|
uses: DeterminateSystems/update-flake-lock@vX
|
||||||
with:
|
with:
|
||||||
inputs: input1 input2 input3
|
inputs: input1 input2 input3
|
||||||
path-to-flake-dir: 'nix/' # in this example our flake doesn't sit at the root of the repository, it sits under 'nix/flake.nix'
|
flake-dirs: 'nix/' # in this example our flake doesn't sit at the root of the repository, it sits under 'nix/flake.nix'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example using a different Git user
|
## Example using a different Git user
|
||||||
|
|
|
@ -21,7 +21,11 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: "update_flake_lock_action"
|
default: "update_flake_lock_action"
|
||||||
path-to-flake-dir:
|
path-to-flake-dir:
|
||||||
description: 'The path of the directory containing `flake.nix` file within your repository. Useful when `flake.nix` cannot reside at the root of your repository.'
|
description: 'Deprecated. Use flake-dirs instead. The path of the directory containing `flake.nix` file within your repository. Useful when `flake.nix` cannot reside at the root of your repository.'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
flake-dirs:
|
||||||
|
description: 'A space-separated list of directories containing `flake.nix` files within your repository. Useful when you have multiple flakes in your repository.'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
pr-title:
|
pr-title:
|
||||||
|
@ -154,6 +158,7 @@ runs:
|
||||||
TARGETS: ${{ inputs.inputs }}
|
TARGETS: ${{ inputs.inputs }}
|
||||||
COMMIT_MSG: ${{ inputs.commit-msg }}
|
COMMIT_MSG: ${{ inputs.commit-msg }}
|
||||||
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}
|
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}
|
||||||
|
FLAKE_DIRS: ${{ inputs.flake-dirs }}
|
||||||
- name: Save PR Body as file
|
- name: Save PR Body as file
|
||||||
uses: DamianReeves/write-file-action@v1.3
|
uses: DamianReeves/write-file-action@v1.3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
|
update(){
|
||||||
cd "$PATH_TO_FLAKE_DIR"
|
if [[ -n "${TARGETS:-}" ]]; then
|
||||||
fi
|
|
||||||
|
|
||||||
options=()
|
|
||||||
if [[ -n "$NIX_OPTIONS" ]]; then
|
|
||||||
for option in $NIX_OPTIONS; do
|
|
||||||
options+=("${option}")
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$TARGETS" ]]; then
|
|
||||||
inputs=()
|
inputs=()
|
||||||
for input in $TARGETS; do
|
for input in $TARGETS; do
|
||||||
inputs+=("--update-input" "$input")
|
inputs+=("--update-input" "$input")
|
||||||
|
@ -21,3 +11,24 @@ if [[ -n "$TARGETS" ]]; then
|
||||||
else
|
else
|
||||||
nix "${options[@]}" flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
|
nix "${options[@]}" flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
options=()
|
||||||
|
if [[ -n "${NIX_OPTIONS:-}" ]]; then
|
||||||
|
for option in $NIX_OPTIONS; do
|
||||||
|
options+=("${option}")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${PATH_TO_FLAKE_DIR:-}" ]]; then
|
||||||
|
cd "$PATH_TO_FLAKE_DIR"
|
||||||
|
update
|
||||||
|
elif [[ -n "${FLAKE_DIRS:-}" ]]; then
|
||||||
|
for flake_dir in $FLAKE_DIRS; do
|
||||||
|
cd "$flake_dir"
|
||||||
|
update
|
||||||
|
done
|
||||||
|
else
|
||||||
|
update
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue