Skip to content

Build and Deploy

Build and Deploy #8

name: Build and Deploy
on:
push:
pull_request:
types: [opened, synchronize, reopened, closed]
workflow_dispatch:
inputs:
deploy-to-azure:
description: '部署到Azure'
default: true
required: true
type: boolean
jobs:
deploy:
timeout-minutes: 20
runs-on: ubuntu-latest
env:
DO_NOT_TRACK: 1
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Fetch docs
uses: actions/checkout@v4
with:
repository: "MaaAssistantArknights/MaaAssistantArknights"
sparse-checkout: "docs"
path: "temp"
ref: "master"
fetch-depth: "1"
- name: Move and cleanup docs
run: |
mv ./temp/docs ./apps
rm -r ./temp
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Deploy to Azure
id: deploy
if: github.repository == 'MaaAssistantArknights/maa-website' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy-to-azure == 'true'))
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KIND_WAVE_001CBA500 }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
production_branch: "main"
app_location: "dist"
api_location: ""
skip_app_build: true
skip_api_build: true