0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00
logto/.github/workflows/release-cloud.yml
2023-03-10 09:47:14 +00:00

83 lines
2.2 KiB
YAML

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
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
jobs:
dockerize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/logto-io/cloud
# https://github.com/docker/metadata-action
tags: |
type=raw,value=${{ inputs.target == 'cloud' && 'prod' || 'edge' }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: silverhand-bot
password: ${{ secrets.BOT_PAT }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
file: Dockerfile.cloud
context: .
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:
runs-on: ubuntu-latest
needs: dockerize
environment: ${{ inputs.target == 'cloud' && 'cloud-prod' || 'cloud-dev' }}
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: silverhand-bot
password: ${{ secrets.BOT_PAT }}
- name: Login via Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to containerapp
uses: azure/webapps-deploy@v2
with:
app-name: logto-cloud-${{ inputs.target == 'cloud' && 'eu' || 'dev' }}
images: ghcr.io/logto-io/cloud:${{ inputs.target == 'cloud' && 'prod' || 'edge' }}