Skip to content

完善Studio模式

完善Studio模式 #8

name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Load environment variables
run: |
echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" >> $GITHUB_ENV
echo "VITE_TTS_KEY=${{ secrets.VITE_TTS_KEY }}" >> $GITHUB_ENV
echo "VITE_Images_URI=${{ secrets.VITE_Images_URI }}" >> $GITHUB_ENV
- name: Install dependencies
run: npm install
- name: Build the Quasar app
run: npm run build
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_DELIGHTFUL_DUNE_04550AF00 }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/" # 确保代码位于项目根目录
api_location: "" # API 目录(如果需要,可设置)
output_location: "dist/spa" # Quasar SPA 默认构建输出目录
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_DELIGHTFUL_DUNE_04550AF00 }}
action: "close"