diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d76c9a3..00798c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,9 @@ test: stage: test script: - nix flake check + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: never deploy: stage: deploy @@ -32,4 +35,33 @@ deploy: # Deploy everything - nix develop --command deploy rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: never - if: $CI_COMMIT_BRANCH == "master" + + +check updates: + stage: test + script: + # Prepare git access + - nix-env -iA nixos.openssh + - eval "$(ssh-agent -s)" + - chmod 0600 $SSH_UPDATE_KEY + - ssh-add $SSH_UPDATE_KEY + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - ssh-keyscan git.lewd.wtf >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + - git config --global user.name "NixOS Flake Update" + - git config --global user.email "git@lewd.wtf" + - git remote rm origin && git remote add origin "git@git.lewd.wtf:${CI_PROJECT_PATH}.git" + # Update flakes + - nix flake update + # Push changes + - git checkout -b flakes_update + - git add . + - git commit -m 'Update NixOS Flakes' + - git push --set-upstream origin flakes_update -o merge_request.create + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" +