nix-matlab/.gitlab-ci.yml
2021-09-07 21:47:28 +03:00

22 lines
930 B
YAML

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