Skip to content

Update dependencies and sources #1122

Update dependencies and sources

Update dependencies and sources #1122

Workflow file for this run

name: "Update dependencies and sources"
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
env:
OLD_HASH: "Unknown"
NEW_HASH: "Unknown"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Nix Flakes doesn't work on shallow clones
fetch-depth: 0
- name: Install nixFlake
uses: cachix/install-nix-action@v20
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/latest/download/install
extra_nix_config: |
experimental-features = nix-command flakes
- name: Configure git
run: |
git config --global user.name 'Automation - Ninlives'
git config --global user.email '[email protected]'
- uses: cachix/cachix-action@v12
with:
name: nixos-cn
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Update dependencies
run: nix flake update
- name: Commit if build succeed
run: |
git diff-index --quiet HEAD \
|| (nix flake check && git commit -am "Update dependencies - Automated Commit" && git push || git stash)
- name: Update registries
run: |
echo "OLD_HASH=$(nix run .#re-export-hash)" >> $GITHUB_ENV
nix run .#update-lock > registries.lock.new
rm registries.lock
mv registries.lock.new registries.lock
echo "NEW_HASH=$(nix run .#re-export-hash)" >> $GITHUB_ENV
- name: Commit if build succeed
run: |
echo OLD_HASH is ${OLD_HASH}
echo NEW_HASH is ${NEW_HASH}
git diff-index --quiet HEAD || if [[ "${NEW_HASH}" != "${OLD_HASH}" ]];then
nix flake check \
&& git commit -am "Update registries - Automated Commit" && git push \
|| git stash
else
git stash
fi
- name: Update packages
run: |
nix run .#update-packages
git push || true