|
10 | 10 | - main |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - build_and_deploy_job: |
| 13 | + build_and_test_job: |
14 | 14 | if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') |
15 | 15 | runs-on: ubuntu-latest |
16 | | - name: Build and Deploy Job |
| 16 | + name: Build and Test Job |
| 17 | + |
17 | 18 | steps: |
18 | 19 | - uses: actions/checkout@v3 |
19 | 20 | with: |
20 | 21 | submodules: true |
21 | 22 | lfs: false |
22 | | - - name: Build And Deploy |
23 | | - id: builddeploy |
| 23 | + |
| 24 | + - name: Setup Node |
| 25 | + uses: actions/setup-node@v3 |
| 26 | + with: |
| 27 | + node-version: '18' |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: npm ci |
| 31 | + |
| 32 | + - name: Build app |
| 33 | + run: npm run build |
| 34 | + |
| 35 | + - name: Run Cypress E2E tests |
| 36 | + run: npx start-server-and-test preview http://localhost:4173 cy:run |
| 37 | + |
| 38 | + deploy_job: |
| 39 | + name: Deploy to Azure Static Web Apps |
| 40 | + needs: build_and_test_job |
| 41 | + runs-on: ubuntu-latest |
| 42 | + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v3 |
| 46 | + |
| 47 | + - name: Deploy |
24 | 48 | uses: Azure/static-web-apps-deploy@v1 |
25 | 49 | with: |
26 | 50 | azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_DUNE_08280A403 }} |
27 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) |
| 51 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
28 | 52 | action: "upload" |
29 | | - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### |
30 | | - # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig |
31 | | - app_location: "/" # App source code path |
32 | | - api_location: "" # Api source code path - optional |
33 | | - output_location: "dist" # Built app content directory - optional |
34 | | - ###### End of Repository/Build Configurations ###### |
| 53 | + app_location: "/" |
| 54 | + api_location: "" |
| 55 | + output_location: "dist" |
35 | 56 |
|
36 | 57 | close_pull_request_job: |
37 | 58 | if: github.event_name == 'pull_request' && github.event.action == 'closed' |
38 | 59 | runs-on: ubuntu-latest |
39 | 60 | name: Close Pull Request Job |
| 61 | + |
40 | 62 | steps: |
41 | 63 | - name: Close Pull Request |
42 | 64 | id: closepullrequest |
|
0 commit comments