63 lines
1.5 KiB
YAML
63 lines
1.5 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: build-and-push-pwa
|
|
|
|
steps:
|
|
- name: build flutter
|
|
image: ghcr.io/cirruslabs/flutter:3.38.10
|
|
commands:
|
|
- flutter --version
|
|
- |
|
|
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"
|
|
- mkdir -p ./artifacts/flutter
|
|
- rm -rf build
|
|
- flutter pub get
|
|
- flutter build web --release --output=build/tm_pwa
|
|
- ls -ltrh build/tm_pwa
|
|
|
|
- name: push pwa
|
|
image: plugins/docker
|
|
settings:
|
|
registry: git.opplens.se
|
|
repo: git.opplens.se/mazyar/pwa
|
|
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 pwa tag $NEW_TAG"
|
|
- sed -i "s/^PWA_IMG_TAG=.*/PWA_IMG_TAG=$NEW_TAG/" .env
|
|
- docker compose pull pwa
|
|
- docker compose up -d pwa
|
|
- docker image prune -f
|
|
when:
|
|
branch:
|
|
- dev
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- uat
|
|
- dev
|
|
event:
|
|
- push
|