revival/.gitlab-ci.yml

71 lines
1.6 KiB
YAML

stages:
- build
- cleanup-build
- deploy
variables:
GIT_STRATEGY: fetch
UNITY_VERSION: 2020.2.2f1
SRC_DIR: ./game
BUILD_DIR: ./game/Build
DEV_BRANCH: feature/cd
PROD_BRANCH: feature/cd-2
build:
stage: build
variables:
# 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
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 $CLEANUP_PATH.tmp
dependencies:
- build
when: always
# deploy to internal testing track
deploy-dev:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $DEV_BRANCH
variables:
ITCH_USER: "cyndrdev"
ITCH_GAME: "revival-internal-track"
ITCH_TRACK: "windows-unstable"
script:
- chmod +x ./ci/deploy.sh
- ./ci/deploy.sh $BUILD_DIR $ITCH_USER $ITCH_GAME $ITCH_TRACK
dependencies:
- build
# deploy to production
deploy-release:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $PROD_BRANCH && $CI_JOB_MANUAL
variables:
ITCH_USER: "cyndrdev"
ITCH_GAME: "revival"
ITCH_TRACK: "windows"
script:
- echo "deploy release :bolb:"
dependencies:
- build