add cleanup job to clear build directory

This commit is contained in:
Cat Flynn 2021-02-01 14:06:31 +00:00
parent bad0b70319
commit b5e904c835
1 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,6 @@
stages:
- build
- cleanup-build
- deploy
variables:
@ -15,18 +16,29 @@ variables:
build:
stage: build
variables:
# instance
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-$CI_JOB_ID
# instance the build job to avoid multiple jobs running in the same project folder
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-build-$CI_PIPELINE_ID
script:
- echo "cloned to $GIT_CLONE_PATH"
- chmod +x ./ci/build.sh
- ./ci/build.sh $UNITY_VERSION
after_script:
- rm -r $GIT_CLONE_PATH
artifacts:
name: $CI_PROJECT_NAME-$CI_PIPELINE_ID
paths:
- $BUILD_DIR
# remove the directory created by the build job. in a separate job
cleanup-build:
stage: cleanup-build
variables:
CLEANUP_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-build-$CI_PIPELINE_ID
script:
- echo "cleaning up build directory"
- rm -r $CLEANUP_PATH
dependencies:
- build
# deploy to internal testing track
deploy-dev: