First trial in a nix flake update CI

This commit is contained in:
Doron Behar 2021-09-07 20:52:46 +03:00
parent 4a49cf8884
commit abad30d9cf

22
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,22 @@
default:
image: nixpkgs/nix-flakes
update-nix-flakes:
# Based on: https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5
before_script:
- eval `ssh-agent -s`
- mkdir --mode=700 -p ~/.ssh
- ssh-keyscan "$CI_SERVER_HOST" >> ~/.ssh/known_hosts
- echo "$SSH_PUBLIC_KEY" >> ~/.ssh/id_rsa.pub
- echo "${SSH_PRIVATE_KEY}" | ssh-add -
script:
- git config --global user.email "nix-matlab-CI@doronbehar.com"
- git config --global user.name "Nix Matlab CI"
- git remote add ci ssh://git@$CI_SERVER_HOST/$CI_PROJECT_PATH.git
- type nix
- nix --version
- nix flake update
- git add .
- git status
- git commit --message "[skip ci] Automatic nix flake update by CI" || echo "No changes, nothing to commit!"
- git push ci HEAD:$CI_COMMIT_REF_NAME # Pushes to the same branch as the trigger