From bd160748cde002467480b88eb7c33ed7540f5f01 Mon Sep 17 00:00:00 2001 From: mazyar Date: Mon, 15 Jun 2026 13:29:20 +0000 Subject: [PATCH] Update .drone.yml --- .drone.yml | 62 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8663715..61846da 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,43 +1,57 @@ -########### MOODIO TEST ########### -################################### - kind: pipeline type: docker -name: (pwa-test) build pwa and scp to test server +name: build-and-push-pwa + steps: - name: build flutter - image: docker-mirror.ravanertebat.ir/ghcr/cirruslabs/flutter:3.38.10 + image: ghcr.io/cirruslabs/flutter:3.38.10 commands: - flutter --version - | set -e - case "$DRONE_BRANCH" in - master) echo prod;; - uat) echo uat;; - dev) echo test;; - *) echo dev;; - esac > .environment - - echo "Branch ${DRONE_BRANCH}, Environment $(cat .environment)" - - APP_VERSION=$(cat .environment)-${DRONE_BUILD_NUMBER} - - echo "APP Version tags $APP_VERSION" - - echo -n "$APP_VERSION,latest" >> .tags + 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: build admin and push to artifactory + - name: push pwa image: plugins/docker settings: - # dockerfile: Dockerfile-admin - username: cicd + registry: git.opplens.se + repo: git.opplens.se/mazyar/pwa + username: + from_secret: registry_username password: - from_secret: REGISTRY_PASSWORD - repo: artifactory.ravanertebat.ir/tm/pwa - registry: artifactory.ravanertebat.ir -node: - tag: aecde-docker-runner + 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: @@ -45,4 +59,4 @@ trigger: - uat - dev event: - - custom + - push