ci: split port & flake input updates (#207)
This commit is contained in:
parent
dc9553ef0b
commit
534be878b3
3 changed files with 62 additions and 70 deletions
31
.github/workflows/update-flake.yml
vendored
Normal file
31
.github/workflows/update-flake.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
name: Update flake.lock
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# run every friday
|
||||||
|
- cron: "0 0 * * 5"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
name: Run update & create PR
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@V27
|
||||||
|
|
||||||
|
- uses: DeterminateSystems/update-flake-lock@v22
|
||||||
|
with:
|
||||||
|
path-to-flake-dir: "./dev"
|
||||||
|
commit-msg: "chore: update dev flake inputs"
|
||||||
|
pr-title: "chore: update dev flake inputs"
|
||||||
|
token: ${{ github.token }}
|
70
.github/workflows/update-lock.yml
vendored
70
.github/workflows/update-lock.yml
vendored
|
@ -1,70 +0,0 @@
|
||||||
name: Update lockfiles
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# run every friday
|
|
||||||
- cron: "0 0 * * 5"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update:
|
|
||||||
name: Run update
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
PR_BRANCH: "update-lockfiles"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@V27
|
|
||||||
|
|
||||||
- name: Set Git user info
|
|
||||||
run: |
|
|
||||||
git config user.name 'github-actions[bot]'
|
|
||||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
|
|
||||||
- name: Create new branch
|
|
||||||
id: branch
|
|
||||||
run: |
|
|
||||||
git switch -c "$PR_BRANCH"
|
|
||||||
|
|
||||||
- name: Update flake inputs
|
|
||||||
run: |
|
|
||||||
pushd dev
|
|
||||||
|
|
||||||
nix flake update \
|
|
||||||
--commit-lock-file \
|
|
||||||
--commit-lockfile-summary "chore: update dev flake inputs"
|
|
||||||
|
|
||||||
popd
|
|
||||||
|
|
||||||
- name: Update port sources
|
|
||||||
run: |
|
|
||||||
nix run --inputs-from ./dev nixpkgs#npins -- update --directory ./.sources
|
|
||||||
if ! git diff --color=always --exit-code; then
|
|
||||||
git commit -am "chore: update port sources"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Make PR if needed
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
if ! git diff --color=always --exit-code origin/main; then
|
|
||||||
git fetch origin "$PR_BRANCH" || true
|
|
||||||
git push --force-with-lease -u origin "$PR_BRANCH"
|
|
||||||
|
|
||||||
open_prs="$(gh pr list --base main --head "$PR_BRANCH" | wc -l)"
|
|
||||||
if [ "$open_prs" -eq 0 ]; then
|
|
||||||
gh pr create \
|
|
||||||
--base main \
|
|
||||||
--head "$PR_BRANCH" \
|
|
||||||
--title "chore: update lockfiles" \
|
|
||||||
--fill
|
|
||||||
fi
|
|
||||||
fi
|
|
31
.github/workflows/update-ports.yml
vendored
Normal file
31
.github/workflows/update-ports.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
name: Update ports
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# run every other weekday
|
||||||
|
- cron: "0 0 * * 1,3,5"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
name: Run update & create PR
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@V27
|
||||||
|
|
||||||
|
- uses: getchoo/update-npins@v0.1.1
|
||||||
|
with:
|
||||||
|
npins-directory: "./.sources"
|
||||||
|
commit-message: "chore: update ports"
|
||||||
|
pr-title: "chore: update ports"
|
||||||
|
token: ${{ github.token }}
|
Loading…
Reference in a new issue