Skip to content

Commit 23c2561

Browse files
authored
Update azure-static-web-apps-witty-pond-0e2ac5d0f.yml
Updated
1 parent 66412a3 commit 23c2561

File tree

1 file changed

+65
-59
lines changed

1 file changed

+65
-59
lines changed
Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,65 @@
1-
name: Azure Static Web Apps CI/CD
2-
3-
on:
4-
push:
5-
branches:
6-
- github
7-
pull_request:
8-
types: [opened, synchronize, reopened, closed]
9-
branches:
10-
- github
11-
12-
jobs:
13-
build_and_deploy_job:
14-
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15-
runs-on: ubuntu-latest
16-
name: Build and Deploy Job
17-
permissions:
18-
id-token: write
19-
contents: read
20-
steps:
21-
- uses: actions/checkout@v3
22-
with:
23-
submodules: true
24-
lfs: false
25-
- name: Install OIDC Client from Core Package
26-
run: npm install @actions/[email protected] @actions/http-client
27-
- name: Get Id Token
28-
uses: actions/github-script@v6
29-
id: idtoken
30-
with:
31-
script: |
32-
const coredemo = require('@actions/core')
33-
return await coredemo.getIDToken()
34-
result-encoding: string
35-
- name: Build And Deploy
36-
id: builddeploy
37-
uses: Azure/static-web-apps-deploy@v1
38-
with:
39-
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WITTY_POND_0E2AC5D0F }}
40-
action: "upload"
41-
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
42-
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
43-
app_location: "/" # App source code path
44-
api_location: "api" # Api source code path - optional
45-
output_location: ".main" # Built app content directory - optional
46-
build_timeout_in_minutes: 30 # Set the timeout to 30 minutes
47-
github_id_token: ${{ steps.idtoken.outputs.result }}
48-
###### End of Repository/Build Configurations ######
49-
50-
close_pull_request_job:
51-
if: github.event_name == 'pull_request' && github.event.action == 'closed'
52-
runs-on: ubuntu-latest
53-
name: Close Pull Request Job
54-
steps:
55-
- name: Close Pull Request
56-
id: closepullrequest
57-
uses: Azure/static-web-apps-deploy@v1
58-
with:
59-
action: "close"
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Changed from 'github' to standard branch name
7+
pull_request:
8+
branches:
9+
- main # Changed from 'github' to standard branch name
10+
11+
jobs:
12+
build_and_deploy_job:
13+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
14+
runs-on: ubuntu-latest
15+
name: Build and Deploy Job
16+
permissions:
17+
id-token: write # Required for OIDC authentication
18+
contents: read
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4 # Updated to latest version
22+
with:
23+
submodules: true
24+
lfs: false
25+
26+
- name: Login to Azure
27+
uses: azure/login@v2 # Proper OIDC authentication
28+
with:
29+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
30+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
31+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
32+
33+
- name: Build And Deploy
34+
uses: Azure/static-web-apps-deploy@v1
35+
with:
36+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
37+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Added for better integration
38+
action: "upload"
39+
app_location: "/"
40+
api_location: "api"
41+
output_location: "build" # Changed to standard output folder
42+
app_build_command: "npm run build" # Added build command
43+
skip_app_build: false
44+
skip_api_build: false
45+
build_timeout_in_minutes: 15 # Reduced timeout to 15 mins
46+
env:
47+
NODE_ENV: production
48+
49+
close_pull_request_job:
50+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
51+
runs-on: ubuntu-latest
52+
name: Close Pull Request Job
53+
permissions:
54+
id-token: write
55+
contents: read
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v4
59+
60+
- name: Close Environment
61+
uses: Azure/static-web-apps-deploy@v1
62+
with:
63+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
64+
action: "close"
65+
repo_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)