57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: build-and-push-landing
|
|
|
|
steps:
|
|
- name: tag
|
|
image: alpine/git:2.40.1
|
|
commands:
|
|
- |
|
|
set -e
|
|
SHORT_SHA=$(echo "$DRONE_COMMIT_SHA" | cut -c1-8)
|
|
IMG_TAG="${DRONE_BUILD_NUMBER}-${DRONE_BRANCH}"
|
|
echo -n "$IMG_TAG,$SHORT_SHA" > .tags
|
|
echo "Image tags -> $IMG_TAG , $SHORT_SHA"
|
|
|
|
- name: build landing
|
|
image: plugins/docker
|
|
settings:
|
|
registry: git.opplens.se
|
|
repo: git.opplens.se/mazyar/landing
|
|
username:
|
|
from_secret: registry_username
|
|
password:
|
|
from_secret: registry_password
|
|
|
|
- name: deploy-uat
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host: 10.0.0.3
|
|
username: mazyar
|
|
port: 22
|
|
key:
|
|
from_secret: ssh_deploy_key
|
|
envs:
|
|
- DRONE_BUILD_NUMBER
|
|
- DRONE_BRANCH
|
|
script:
|
|
- set -e
|
|
- cd /data/tm-uat
|
|
- NEW_TAG="${DRONE_BUILD_NUMBER}-${DRONE_BRANCH}"
|
|
- echo "Deploying landing tag $NEW_TAG"
|
|
- sed -i "s/^LANDING_IMG_TAG=.*/LANDING_IMG_TAG=$NEW_TAG/" .env
|
|
- docker compose pull landing
|
|
- docker compose up -d landing
|
|
- docker image prune -f
|
|
when:
|
|
branch:
|
|
- dev
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
- uat
|
|
- dev
|
|
event:
|
|
- push
|