kind: pipeline type: docker name: default concurrency: limit: 1 environment: SPT_ITEMS_PATH: /var/www/html/aki/spt-items-api trigger: event: - push - promote steps: - name: fetch and update submodules to the latest commit image: alpine/git commands: - git submodule init - git submodule update --recursive --remote - name: replace hosts and user variables image: ubuntu:impish environment: DEPLOY_HOSTNAME: from_secret: deploy_hostname SPT_ITEMS_HOSTNAME: from_secret: spt_items_hostname DEPLOYMENT_USER: from_secret: deploy_username commands: - sed -i 's/{{ SPT_ITEMS_HOSTNAME }}/'"$SPT_ITEMS_HOSTNAME"'/g' ./frontend/.env - sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible/inventory - sed -i 's/{{ DEPLOYMENT_USER }}/'"$DEPLOYMENT_USER"'/g' ./.ansible/inventory - name: build frontend image: node:lts-alpine3.14 commands: - node -v - npm -v - yarn --version - yarn --cwd ./frontend install - yarn --cwd ./frontend build --pure-lockfile - rm -rf ./api/public/static/* - mv ./frontend/build/* ./api/public - rm ./api/public/index.html - name: check ansible syntax image: plugins/ansible:3 settings: playbook: ./.ansible/playbook.yml inventory: ./.ansible/inventory galaxy: ./.ansible/requirements.yml syntax_check: true - name: apply ansible playbook image: plugins/ansible:3 settings: playbook: ./.ansible/playbook.yml inventory: ./.ansible/inventory galaxy: ./.ansible/requirements.yml private_key: from_secret: deploy_ssh_key environment: DEPLOY_HOSTNAME: from_secret: deploy_hostname SPT_ITEMS_HOSTNAME: from_secret: spt_items_hostname DEPLOYMENT_USER: from_secret: deploy_username when: event: - promote target: - production