nixos-config/.gitlab-ci/update.yml
Charlotte Van Petegem 2f174725fe
Fix update workflow
2023-01-28 13:31:31 +01:00

48 lines
1.2 KiB
YAML

stages:
- prepare
- build
- commit
workflow:
name: "Update dependencies"
update-flake-lock:
stage: prepare
script: nix flake update
artifacts:
paths:
- flake.lock
expire_in: 1 day
build-nixos-configurations:
stage: build
parallel:
matrix:
- HOST_TO_BUILD:
- kharbranth
- kholinar
- lasting-integrity
- urithiru
needs:
- job: update-flake-lock
artifacts: true
script:
- nix-env --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
- cachix --version
- cachix authtoken $CACHIX_AUTH_TOKEN
- nix build -L --no-link .#nixosConfigurations.${HOST_TO_BUILD}.config.system.build.toplevel
- nix eval --json .#nixosConfigurations.${HOST_TO_BUILD}.config.system.build.toplevel | sed 's/"\(.*\)"/\1/' | cachix push chvp
commit-and-push:
stage: commit
needs:
- job: update-flake-lock
artifacts: true
- job: build-nixos-configurations
script:
- url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
- git remote set-url origin "https://gitlab-ci-token:${CI_PUSH_TOKEN}@${url_host}"
- git add flake.lock
- git commit -m "Update dependencies"
- git push origin $CI_COMMIT_BRANCH