try to fix update routine
This commit is contained in:
parent
87ab03b22e
commit
34a42131b2
1 changed files with 27 additions and 7 deletions
|
@ -2,32 +2,52 @@ name: Update Nix flakes and commit changes
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 23 * * *"
|
- cron: "5/10 * * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-and-commit:
|
update-and-commit:
|
||||||
runs-on: native
|
runs-on: native
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: "update"
|
ref: "update"
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Git
|
- name: setup git
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "action@git.ingolf-wagner.de"
|
git config --local user.email "action@git.ingolf-wagner.de"
|
||||||
git config --local user.name "Forgejo Action"
|
git config --local user.name "Forgejo Action"
|
||||||
|
|
||||||
- name: Rebase with main branch
|
- name: rebase with main branch
|
||||||
run: |
|
run: |
|
||||||
git fetch origin main
|
git fetch origin main
|
||||||
git rebase origin/main
|
git rebase origin/main
|
||||||
|
|
||||||
- name: Update Nix flakes
|
- name: setup ssh
|
||||||
|
run: |
|
||||||
|
cat <<EOF > .id_rsa
|
||||||
|
${{ secrets.SSH_KEY }}
|
||||||
|
EOF
|
||||||
|
chmod 600 .id_rsa
|
||||||
|
|
||||||
|
eval $(ssh-agent)
|
||||||
|
ssh-add .id_rsa
|
||||||
|
|
||||||
|
cat <<EOF > "$GITHUB_ENV"
|
||||||
|
SSH_AUTH_SOCK="$SSH_AUTH_SOCK"
|
||||||
|
SSH_AGENT_PID=$SSH_AGENT_PID
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: update nix flakes
|
||||||
run: nix flake update
|
run: nix flake update
|
||||||
|
|
||||||
- name: Commit and Push changes
|
- name: commit and push changes
|
||||||
run: |
|
run: |
|
||||||
git diff --quiet && git diff --staged --quiet || (git commit -am "Update Nix flakes" && git push)
|
git diff --quiet && git diff --staged --quiet || (git commit -am "Update Nix flakes" && git push)
|
||||||
|
|
||||||
|
- name: teardown ssh
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
echo $SSH_AGENT_PID
|
||||||
|
kill $SSH_AGENT_PID
|
||||||
|
|
Loading…
Reference in a new issue