From 5034844646f0d3fd26efa9ae66ffb74352e6fa4c Mon Sep 17 00:00:00 2001 From: Subho Date: Mon, 29 Jul 2024 12:12:23 +0530 Subject: [PATCH] deploy artifacts to github pages if test fails --- .github/workflows/format-lint-test.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/format-lint-test.yml b/.github/workflows/format-lint-test.yml index 0189aff..48e4511 100644 --- a/.github/workflows/format-lint-test.yml +++ b/.github/workflows/format-lint-test.yml @@ -45,9 +45,28 @@ jobs: run: npm run test # Upload test results on failure - - uses: actions/upload-artifact@v4 + - uses: actions/upload-pages-artifact@v3 if: failure() with: - name: playwright-report path: playwright-report/ - retention-days: 30 + + deploy: + if: always() && needs.test.result == 'failure' + needs: test + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4