|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +# GitHub recommends pinning actions to a commit SHA. |
| 7 | +# To get a newer version, you will need to update the SHA. |
| 8 | +# You can also reference a tag or branch, but the action may change without warning. |
| 9 | + |
| 10 | +name: Testing deployment |
| 11 | + |
| 12 | +env: |
| 13 | + APP_LOCATION: "/" # location of your client code |
| 14 | + APP_ARTIFACT_LOCATION: "/dist" # location of client code build output |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: |
| 19 | + - production-math |
| 20 | + pull_request: |
| 21 | + types: [opened, synchronize, reopened, closed] |
| 22 | + branches: |
| 23 | + - production-math |
| 24 | + |
| 25 | +permissions: |
| 26 | + issues: write |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + test: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + - name: Run Tests |
| 35 | + run: | |
| 36 | + npm ci |
| 37 | + npm test |
| 38 | + formatting_and_linting: |
| 39 | + name: Prettier / svelte Check |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: Checkout Repository |
| 43 | + uses: actions/checkout@v3 |
| 44 | + - name: Run prettier |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + npm ci |
| 48 | + npm run checkFormat |
| 49 | + - name: Svelte check |
| 50 | + shell: bash |
| 51 | + run: npm run check |
| 52 | + |
| 53 | + build_and_deploy: |
| 54 | + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') |
| 55 | + runs-on: ubuntu-latest |
| 56 | + name: Build and Deploy |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v3 |
| 59 | + with: |
| 60 | + submodules: true |
| 61 | + - name: Build And Deploy |
| 62 | + uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 |
| 63 | + with: |
| 64 | + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_PRODUCTION_MATH_TOKEN }} |
| 65 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + action: "upload" |
| 67 | + app_location: ${{ env.APP_LOCATION }} |
| 68 | + app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }} |
| 69 | + |
| 70 | + close: |
| 71 | + if: github.event_name == 'pull_request' && github.event.action == 'closed' |
| 72 | + runs-on: ubuntu-latest |
| 73 | + name: Close |
| 74 | + steps: |
| 75 | + - name: Close |
| 76 | + uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 |
| 77 | + with: |
| 78 | + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_PRODUCTION_MATH_TOKEN }} |
| 79 | + action: "close" |
0 commit comments