stages: [build, test, release, deploy]
variables:
NODE_VERSION: "20"
build:
stage: build
image: node:${NODE_VERSION}
script:
- npm ci
- npm run build
artifacts:
paths: [dist/]
test:
stage: test
image: node:${NODE_VERSION}
needs: [build]
script:
- npm ci
- npm test -- --coverage
release:
stage: release
needs: [test]
script:
- echo "publish dist/ to artifact registry, tag $CI_COMMIT_TAG"
rules:
- if: $CI_COMMIT_TAG
deploy_prod:
stage: deploy
needs: [test]
environment: production
script: ./deploy.sh
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: manual
stages: [build, test, release, deploy]
variables:
NODE_VERSION: "20"
build:
stage: build
image: node:${NODE_VERSION}
script:
- npm ci
- npm run build
artifacts:
paths: [dist/]
test:
stage: test
image: node:${NODE_VERSION}
needs: [build]
script:
- npm ci
- npm test -- --coverage
release:
stage: release
needs: [test]
script:
- echo "publish dist/ to artifact registry, tag $CI_COMMIT_TAG"
rules:
- if: $CI_COMMIT_TAG
deploy_prod:
stage: deploy
needs: [test]
environment: production
script: ./deploy.sh
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: manual