Skip to content

Update Azure Static Web Apps workflow configuration #2

Update Azure Static Web Apps workflow configuration

Update Azure Static Web Apps workflow configuration #2

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
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
# Se você não precisa de nada de Node aqui, pode remover os 2 passos abaixo.
- name: Install OIDC Client from Core Package
run: npm install @actions/core@1.6.0 @actions/http-client
- name: Get Id Token
uses: actions/github-script@v6
id: idtoken
with:
script: |
const coredemo = require('@actions/core')
return await coredemo.getIDToken()
result-encoding: string
- 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_GENTLE_BAY_009857F10 }}
action: "upload"
# Caminho onde está seu index.html
app_location: "/"
# Se não há API (Azure Functions), deixe vazio
api_location: ""
# PULE o build do app/API
skip_app_build: true
skip_api_build: true
# Quando pulamos o build, o output é a própria app_location.
# Em muitos exemplos deixa-se vazio:
output_location: ""
# Se você manteve o passo "Get Id Token"
github_id_token: ${{ steps.idtoken.outputs.result }}
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- uses: Azure/static-web-apps-deploy@v1
with:
action: "close"