|
1 | | -name: Azure Static Web Apps CI/CD |
| 1 | +name: Build & Deploy |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
8 | 8 | jobs: |
9 | 9 | build_and_deploy_job: |
10 | 10 | runs-on: ubuntu-latest |
11 | | - name: Build and Deploy Job |
| 11 | + name: Build and Deploy to Azure Static Web App |
12 | 12 | permissions: |
13 | 13 | id-token: write |
14 | 14 | contents: read |
15 | 15 | steps: |
| 16 | + # Checkout the repo |
16 | 17 | - uses: actions/checkout@v3 |
17 | 18 | with: |
18 | 19 | submodules: true |
19 | 20 | lfs: false |
20 | | - - name: Install OIDC Client from Core Package |
21 | | - run: npm install @actions/core@1.6.0 @actions/http-client |
22 | | - - name: Get Id Token |
23 | | - uses: actions/github-script@v6 |
24 | | - id: idtoken |
| 21 | + # Install .Net and build the application |
| 22 | + - uses: actions/setup-dotnet@v5 |
25 | 23 | with: |
26 | | - script: | |
27 | | - const coredemo = require('@actions/core') |
28 | | - return await coredemo.getIDToken() |
29 | | - result-encoding: string |
30 | | - - name: Build And Deploy |
| 24 | + dotnet-version: '9.0.x' |
| 25 | + - run: | |
| 26 | + cd api |
| 27 | + dotnet build -o dist |
| 28 | + # Install Node.js and build the application |
| 29 | + - uses: actions/setup-node@v3 |
| 30 | + with: |
| 31 | + node-version: '22.x' |
| 32 | + - run: | |
| 33 | + cd ui |
| 34 | + npm ci |
| 35 | + npm run build |
| 36 | + # Deploy the application to Azure Static Web Apps |
| 37 | + - name: Deploy |
31 | 38 | id: builddeploy |
32 | 39 | uses: Azure/static-web-apps-deploy@v1 |
33 | 40 | with: |
34 | 41 | azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} |
35 | 42 | repo_token: ${{ secrets.GITHUB_TOKEN }} |
36 | 43 | action: "upload" |
37 | | - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### |
38 | 44 | # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig |
39 | | - app_location: "./ui" # App source code path |
40 | | - app_build_command: "npm ci && npm run build" # App build command |
41 | | - output_location: "dist/home-library/browser" # Built app content directory - optional |
42 | | - api_location: "./api" # Api source code path - optional |
43 | | - api_build_command: "dotnet build" # Api build command - optional |
44 | | - ###### End of Repository/Build Configurations ###### |
| 45 | + app_location: "./ui/dist/home-library/browser" # Location of the built application |
| 46 | + output_location: "" # Must be blank for pre-built apps |
| 47 | + api_location: "./api/dist" # Api source code path - optional |
| 48 | + # Skip build commands, we do it ourselves |
| 49 | + skip_app_build: true |
| 50 | + skip_api_build: true |
0 commit comments