37 lines
843 B
YAML
37 lines
843 B
YAML
stages:
|
|
- build
|
|
- test
|
|
- deploy
|
|
|
|
frontend-build-job:
|
|
image: node:20-alpine
|
|
stage: build
|
|
script:
|
|
- cd SurveyFrontend
|
|
- npm install
|
|
- npm run build
|
|
artifacts:
|
|
paths:
|
|
- SurveyFrontend/dist
|
|
expire_in: 1 hour
|
|
|
|
frontend-test-job:
|
|
image: alpine:latest
|
|
stage: test
|
|
script:
|
|
- echo "Here we would run some tests if I knew how to use them"
|
|
|
|
frontend-deploy-job:
|
|
image: alpine:latest
|
|
stage: deploy
|
|
rules:
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
before_script:
|
|
- apk add --no-cache openssh
|
|
- mkdir -p ~/.ssh
|
|
- echo "$DEPLOY_KEY" | base64 -d > ~/.ssh/id_rsa
|
|
- chmod 600 ~/.ssh/id_rsa
|
|
- ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts
|
|
script:
|
|
- echo "Deploying frontend to $DEPLOY_HOST"
|
|
- scp -r SurveyFrontend/dist/* $DEPLOY_USER@$DEPLOY_HOST:$FRONTEND_DEPLOY_PATH
|