From 7654485a6dbc9aa14a72ec2ccd9a4b7941b3e6f2 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Wed, 9 Aug 2023 20:12:43 +0100 Subject: [PATCH] ci: improve it so some thigns only run on main --- .gitlab-ci.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bdc2e47..1b9823a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ update: - $UPDATE_FLAKE == "yes" # every commit on main will build and deploy -.build_template: &build +.build_template: &builder tags: - nix before_script: @@ -54,8 +54,6 @@ update: - . "$HOME/.nix-profile/etc/profile.d/nix.sh" - git pull origin main only: - refs: - - main changes: - applications/**/* - machines/**/* @@ -63,21 +61,29 @@ update: - flake.* - .gitlab-ci.yml +# deploy items only run on main +.deploy_template: &deployment + only: + refs: + - main + build: - <<: *build + <<: *builder stage: test script: - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- build # dns always has to be deployed first deploy_dns: - <<: *build + <<: *builder + <<: *deployment stage: deploy script: - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active-dns deploy_core: - <<: *build + <<: *builder + <<: *deployment stage: deploy needs: - deploy_dns @@ -85,7 +91,8 @@ deploy_core: - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active-core deploy_active: - <<: *build + <<: *builder + <<: *deployment stage: deploy needs: - deploy_dns @@ -93,7 +100,8 @@ deploy_active: - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active deploy_gitlab: - <<: *build + <<: *builder + <<: *deployment stage: deploy_gitlab script: - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active-gitlab