ci: only run the scripts that need envs to be added on main

This commit is contained in:
silver 2023-08-09 20:27:04 +01:00
parent d5b96daa2c
commit d630c72488

View file

@ -40,19 +40,24 @@ update:
variables: variables:
- $UPDATE_FLAKE == "yes" - $UPDATE_FLAKE == "yes"
.scripts_base: &scripts_base
# load nix environment
- . "$HOME/.nix-profile/etc/profile.d/nix.sh"
- git pull origin main
.scripts_deploy: &scripts_deploy
# setup ssh key
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
# every commit on main will build and deploy # every commit on main will build and deploy
.build_template: &builder .build_template: &builder
tags: tags:
- nix - nix
before_script: before_script:
# setup ssh key - *scripts_base
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
# load nix environment
- . "$HOME/.nix-profile/etc/profile.d/nix.sh"
- git pull origin main
only: only:
changes: changes:
- applications/**/* - applications/**/*
@ -63,6 +68,9 @@ update:
# deploy items only run on main # deploy items only run on main
.deploy_template: &deployment .deploy_template: &deployment
before_script:
- *scripts_deploy
- *scripts_base
only: only:
refs: refs:
- main - main