From 6c4a9c336fcfa1fcadde3ce2f042c59bc9dc32c9 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Fri, 10 Mar 2023 16:13:09 +0800 Subject: [PATCH] ci: release cloud prod (#3351) --- .github/workflows/release-cloud.yml | 25 +++++++++++++++++-------- Dockerfile.cloud | 4 ++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-cloud.yml b/.github/workflows/release-cloud.yml index 56fb9fd23..c108327b4 100644 --- a/.github/workflows/release-cloud.yml +++ b/.github/workflows/release-cloud.yml @@ -2,6 +2,15 @@ name: Release Cloud on: workflow_dispatch: + inputs: + target: + description: 'The release target of Logto Cloud' + required: true + default: cloud + type: choice + options: + - cloud + push: branches: - master @@ -11,7 +20,6 @@ concurrency: jobs: dockerize: - environment: ${{ startsWith(github.ref, 'refs/tags/') && 'release' || '' }} runs-on: ubuntu-latest steps: @@ -25,9 +33,9 @@ jobs: with: images: | ghcr.io/logto-io/cloud - # https://github.com/docker/metadata-action#typesemver + # https://github.com/docker/metadata-action tags: | - type=edge + type=raw,value=${{ inputs.target == 'cloud' && 'prod' || 'edge' }} - name: Login to GitHub Container Registry uses: docker/login-action@v2 @@ -47,12 +55,13 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: + - admin_endpoint: https://auth.logto.${{ inputs.target == 'cloud' && 'io' || 'dev' }}/ - deploy-dev: + deploy: runs-on: ubuntu-latest needs: dockerize - environment: cloud-dev - if: ${{ !startsWith(github.ref, 'refs/tags/') }} + environment: ${{ inputs.target == 'cloud' && 'cloud-prod' || 'cloud-dev' }} steps: - name: Login to GitHub Container Registry @@ -70,5 +79,5 @@ jobs: - name: Deploy to containerapp uses: azure/webapps-deploy@v2 with: - app-name: logto-cloud-dev - images: ghcr.io/logto-io/cloud:edge + app-name: logto-cloud-${{ inputs.target == 'cloud' && 'eu' || 'dev' }} + images: ghcr.io/logto-io/cloud:${{ inputs.target == 'cloud' && 'prod' || 'edge' }} diff --git a/Dockerfile.cloud b/Dockerfile.cloud index 4d835fdaa..9c3cc44f7 100644 --- a/Dockerfile.cloud +++ b/Dockerfile.cloud @@ -21,8 +21,8 @@ RUN pnpm i # Admin Console build env ENV CONSOLE_PUBLIC_URL=/ ENV IS_CLOUD=1 -# Temporarily use it for Admin Console build, will try to use runtime technique later -ENV ADMIN_ENDPOINT=https://auth.logto.dev/ +ARG admin_endpoint +ENV ADMIN_ENDPOINT=${admin_endpoint} RUN pnpm prepack RUN pnpm -r --filter @logto/console --filter @logto/cloud build