File: /var/www/quadcode.com/builds/-DFbjr9L/0/foach/quadcode.com/.gitlab-ci.yml
stages:
- build
- deploy
variables:
ANSIBLE_USER: qc_deploy
build:
stage: build
image: node:16.20.2-alpine3.18
before_script:
- PWD_DIR=$(pwd)
script:
- cd $PWD_DIR
- node -v
- npm install
- npm run build
artifacts:
name: quadcode_com
expire_in: 1d
paths:
- build
- node_modules
- .svelte-kit
tags:
- linux_amd64_standard
.job-deploy: &job-deploy
stage: deploy
image: registry.mobbtech.com/infra/ansible-ci:2.9.14-2
when: manual
before_script:
- mkdir -m 700 ~/.ssh
- echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa
- ssh-keyscan gitlab.mobbtech.com >> ~/.ssh/known_hosts
- chmod 600 ~/.ssh/id_rsa
- mkdir -p -m 700 ~/.ansible/roles
- ansible-galaxy install -f -r .deploy/roles/requirements.yml -vv
- export ANSIBLE_CONFIG=.deploy/ansible.cfg
- PWD_DIR=$(pwd)
script:
- cd $PWD_DIR && tar -czf $PWD_DIR/.deploy/app.tgz build node_modules .svelte-kit package.json
- tar -tvf $PWD_DIR/.deploy/app.tgz
- ansible-playbook .deploy/main.yml -i .deploy/inventory -l $GITLAB_DEPLOY_TO -u "${ANSIBLE_USER}" -D -v
tags:
- linux_amd64_standard
- $GITLAB_DEPLOY_TO
dependencies:
- build
production:
<<: *job-deploy
environment: production
only:
- main
- /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
- deploy
variables:
GITLAB_DEPLOY_TO: production
integration:
<<: *job-deploy
environment: integration
variables:
GITLAB_DEPLOY_TO: integration