removed example blog #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy web app to Azure Static Web Apps | |
on: | |
push: | |
branches: [ "azure" ] | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: [ "azure" ] | |
# Environment variables available to all jobs and steps in this workflow | |
env: | |
APP_LOCATION: "/dist" # location of your client code | |
# API_LOCATION: "api" # location of your api source code - optional | |
APP_ARTIFACT_LOCATION: "dist" # location of client code build output | |
OUTPUT_LOCATION: "dist" # location of client code build output | |
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_NICE_POND_0929FCD10 }} # secret containing deployment token for your static web app | |
permissions: | |
contents: read | |
jobs: | |
build_and_deploy_job: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
pull-requests: write # for Azure/static-web-apps-deploy to comment on PRs | |
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 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.17.x | |
cache: 'npm' | |
- run: npm i -g pnpm | |
- run: pnpm config set store-dir .pnpm-store | |
- run: pnpm i | |
- run: pnpm run build | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing api token for app | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
###### Repository/Build Configurations - These values can be configured to match you app requirements. ###### | |
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig | |
app_location: ${{ env.APP_LOCATION }} | |
# api_location: ${{ env.API_LOCATION }} | |
skip_app_build: true | |
skip_api_build: true | |
app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }} | |
output_location: ${{ env.OUTPUT_LOCATION }} | |
###### End of Repository/Build Configurations ###### | |
close_pull_request_job: | |
permissions: | |
contents: none | |
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: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing api token for app | |
action: "close" |