
기존에는 작업 브랜치를 두고 배포 브랜치에 머지하는 식으로 서비스를 배포했다.
하지만 하나의 동일한 빌드를 두고 중복으로 브랜치 머지하는 것이 번거로운 작업이다.
따라서 볼륨 설정 필요하다.

배포 시에 parellel 적용 필요 (https://docs.gitlab.com/ee/ci/yaml/#needsparallelmatrix)
stages:
- build
- deploy
- tag
variables:
GITLAB_TOKEN_HEADER: "PRIVATE-TOKEN: ${GITLAB_TOKEN}"
build:
stage: build
script:
- npm -g install pnpm
- pnpm install
- pnpm run build
when: manual
only:
refs:
- /^release\/.*$/
deploy:
stage: deploy
variables:
GIT_CLEAN_FLAGS: none
script:
- npm -g install pnpm
- pnpm deploy:$ZONE
parallel:
matrix:
- ZONE: [ 'alpha', 'cpdev', 'real' ]
when: manual
only:
refs:
- /^release\/.*$/
tag:
stage: tag
script:
- TAG_NAME="REAL-$(date '+%y-%m-%d-%H%M%S')"
- curl --request POST --header "${GITLAB_TOKEN_HEADER}" --url "https://{gitlab 레포 url}/api/v4/projects/$CI_PROJECT_ID/repository/tags?tag_name=${TAG_NAME}&ref=$CI_COMMIT_REF_NAME"
when: manual
only:
refs:
- /^release\/.*$/
tag 이름을 변수로 사용 시에 아래와 같은 이슈 발생
-> 실제 명령어 수행을 하여 동적으로 tag를 생성해야 된다.

