mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
ci: update website deployment action to support deployment_environment
This commit is contained in:
35
.github/workflows/deploy-website.yaml
vendored
35
.github/workflows/deploy-website.yaml
vendored
@@ -1,14 +1,15 @@
|
||||
name: Build and Deploy
|
||||
name: Deploy Website
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
deploy-to-azure:
|
||||
description: "部署到Azure"
|
||||
default: true
|
||||
deploy-to-prod-env:
|
||||
description: "Deploy to production environment"
|
||||
default: false
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
@@ -42,6 +43,24 @@ jobs:
|
||||
run: pnpm run build
|
||||
working-directory: "./website"
|
||||
|
||||
- name: Set deployment environment
|
||||
id: set-deployment-env
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
|
||||
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
|
||||
echo "AZURE_TARGET_ENV=Production" >> $GITHUB_ENV
|
||||
else
|
||||
echo "AZURE_TARGET_ENV=dev" >> $GITHUB_ENV
|
||||
fi
|
||||
else
|
||||
if [[ "${{ github.event.inputs.deploy-to-prod-env }}" == "true" ]]; then
|
||||
echo "AZURE_TARGET_ENV=Production" >> $GITHUB_ENV
|
||||
else
|
||||
echo "AZURE_TARGET_ENV=dev" >> $GITHUB_ENV
|
||||
fi
|
||||
fi
|
||||
echo "Deployment environment: ${{ env.AZURE_TARGET_ENV }}"
|
||||
|
||||
- name: Deploy to Azure
|
||||
id: deploy
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
@@ -49,7 +68,7 @@ jobs:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_MAA_WEBSITE }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
action: "upload"
|
||||
production_branch: "master"
|
||||
deployment_environment: ${{ env.AZURE_TARGET_ENV }}
|
||||
app_location: "./website/dist"
|
||||
api_location: ""
|
||||
skip_app_build: true
|
||||
|
||||
Reference in New Issue
Block a user