-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
39 lines (39 loc) · 1.13 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
stages: [update, tag]
variables:
GIT_AUTHOR_EMAIL: [email protected]
GIT_AUTHOR_NAME: Gitlab CI
GIT_STRATEGY: clone
REPO_URL: $CI_SERVER_PROTOCOL://gitlab-ci-token:$ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git
update:
stage: update
image: nixpkgs/nix-flakes:latest
script:
- nix flake update
- nix flake update --flake ./internal/updater --inputs-from . --override-input nixpkgs "nixpkgs"
- |
if git diff --exit-code; then
echo "No changes to flake.lock"
exit 0;
fi
- |
git config --global user.name "$GIT_AUTHOR_NAME"
git config --global user.email "$GIT_AUTHOR_EMAIL"
- git add flake.lock internal/updater/flake.lock
- "git commit -m 'chore(flake.lock): bump flakes'"
- git push "$REPO_URL" HEAD:main
only:
variables: [$UPDATE == "true"]
refs: [main]
tag:
stage: tag
image: nixpkgs/nix-flakes:latest
script:
# Test and deploy
- nix flake check
- nix build .#internal.ci --dry-run >/dev/null
- git tag -f v2
- git push --atomic -f $REPO_URL v2 HEAD:refs/heads/stable
only:
refs: [main]
variables: [$UPDATE != "true"]