From e254339e8ef6bdab29175fdeb0852a06c7008e2e Mon Sep 17 00:00:00 2001
From: Gao Sun <gao@silverhand.io>
Date: Sat, 1 Oct 2022 22:44:29 +0800
Subject: [PATCH] chore: test deployment (#2040)

chore: update dev deployment
---
 .github/workflows/deploy-dev.yml | 57 --------------------------------
 .github/workflows/release.yml    | 20 +++++++++++
 2 files changed, 20 insertions(+), 57 deletions(-)
 delete mode 100644 .github/workflows/deploy-dev.yml

diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml
deleted file mode 100644
index 2726272d9..000000000
--- a/.github/workflows/deploy-dev.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-name: Deploy Dev
-
-on:
-  push:
-    branches: [master]
-
-concurrency: deploy-dev
-
-jobs:
-  deploy:
-    environment: dev
-    runs-on: ubuntu-latest
-
-    steps:
-      - uses: actions/checkout@v3
-
-      - name: Setup Node and pnpm
-        uses: silverhand-io/actions-node-pnpm-run-steps@v1.2.3
-
-      - name: Build
-        run: pnpm -- lerna run build --stream
-
-      - name: Add official connectors
-        run: pnpm add-official-connectors
-        working-directory: packages/core
-
-      # See warning in https://pnpm.io/cli/prune
-      - name: Prune
-        run: rm -rf node_modules packages/*/node_modules && pnpm i
-        env:
-          NODE_ENV: production
-
-      - name: Setup env
-        working-directory: packages/core
-        run: echo "$DEV_CORE_ENV" >> .env
-        env:
-          DEV_CORE_ENV: ${{ secrets.DEV_CORE_ENV }}
-
-      - name: Install SSH key
-        uses: shimataro/ssh-key-action@v2
-        with:
-          key: ${{ secrets.DEV_SSH_KEY }}
-          known_hosts: ${{ secrets.DEV_SSH_KNOWN_HOSTS }}
-          config: ${{ secrets.DEV_SSH_CONFIG }}
-
-      - name: Rsync folder
-        run: rsync --filter='exclude .git' -r -a --delete-before --ignore-times ./ $DEV_SERVER_IP:~/logto
-        env:
-          DEV_SERVER_IP: ${{ secrets.DEV_SERVER_IP }}
-
-      - name: Sleep for 10 seconds
-        run: sleep 10s
-
-      - name: Health check
-        run: curl $DEV_SERVER_URL/api/status -If
-        env:
-          DEV_SERVER_URL: ${{ secrets.DEV_SERVER_URL }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8f519bce1..1069085dc 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -58,6 +58,26 @@ jobs:
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
 
+  deploy-dev:
+    runs-on: ubuntu-latest
+    needs: dockerize
+    environment: dev
+    if: ${{ !startsWith(github.ref, 'refs/tags/')' }}
+
+    steps:
+      - name: Login via Azure CLI
+        uses: azure/login@v1
+        with:
+          creds: ${{ secrets.AZURE_CREDENTIALS }}
+      
+      - name: Deploy to containerapp
+        uses: azure/CLI@v1
+        with:
+          inlineScript: |
+            az config set extension.use_dynamic_install=yes_without_prompt
+            az containerapp update -n logto-dev -g LogtoDev --image svhd/logto:edge
+
+
   create-github-release:
     runs-on: ubuntu-latest
     if: startsWith(github.ref, 'refs/tags/')