diff --git a/.github/workflows/azure-static-web-apps-red-field-0505d1e1e.yml b/.github/workflows/azure-static-web-apps-red-field-0505d1e1e.yml new file mode 100644 index 0000000..a4b246c --- /dev/null +++ b/.github/workflows/azure-static-web-apps-red-field-0505d1e1e.yml @@ -0,0 +1,48 @@ +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 + name: Build and Deploy Job + steps: + - uses: actions/checkout@v3 + with: + submodules: true + lfs: false + - name: Install dependencies + run: npm ci + - 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_RED_FIELD_0505D1E1E }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "./packages/react-frontend" # App source code path + api_location: "" # Api source code path - optional + output_location: "dist" # Built app content directory - optional + ###### End of Repository/Build Configurations ###### + + close_pull_request_job: + if: github.event_name == 'pull_request' && github.event.action == 'closed' + runs-on: ubuntu-latest + name: Close Pull Request Job + steps: + - name: Close Pull Request + id: closepullrequest + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_RED_FIELD_0505D1E1E }} + action: "close" diff --git a/.github/workflows/main_safehaven307.yml b/.github/workflows/main_safehaven307.yml index f9d613c..bc2d1c5 100644 --- a/.github/workflows/main_safehaven307.yml +++ b/.github/workflows/main_safehaven307.yml @@ -21,8 +21,9 @@ jobs: with: node-version: '18.x' - - name: npm install, build, and test + - name: npm ci, install, build, and test run: | + npm ci npm install npm run build --if-present npm run test --if-present @@ -42,8 +43,8 @@ jobs: environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} - permissions: - id-token: write #This is required for requesting the JWT + permissions: + id-token: write #This is required for requesting the JWT steps: - name: Download artifact from build job @@ -53,13 +54,13 @@ jobs: - name: Unzip artifact for deployment run: unzip release.zip - - - name: Login to Azure - uses: azure/login@v1 - with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8E035D0A5DBB427DB4E111FD5E29588D }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_DF80774E585345278225BFF2A80D3DAC }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_88658FF7ABDD4CC29352BE0098BD19FB }} + + - name: Login to Azure + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8E035D0A5DBB427DB4E111FD5E29588D }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_DF80774E585345278225BFF2A80D3DAC }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_88658FF7ABDD4CC29352BE0098BD19FB }} - name: 'Deploy to Azure Web App' id: deploy-to-webapp @@ -68,4 +69,4 @@ jobs: app-name: 'SafeHaven307' slot-name: 'Production' package: . - \ No newline at end of file +