Deploy e2e test page #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Deploy e2e test page' | |
on: | |
schedule: | |
- cron: '0 6 * * 3' # Run every Wednesday at 6am UTC | |
workflow_dispatch: | |
inputs: | |
use-branch: | |
description: 'Enable if you want to test data from your selected branch instead of the scheduled test runs from Main' | |
type: boolean | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ vars.E2E_PAGE_SITE_ID }} | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get run id | |
id: get-run-id | |
run: | | |
if [ "${{ inputs.use-branch }}" == "true" ]; then | |
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e workflow_dispatch -s success -b $GITHUB_REF_NAME --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY) | |
else | |
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e schedule -s success --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY) | |
fi | |
echo "runId=$E2E_RUN_ID" >> $GITHUB_OUTPUT | |
- name: Download latest e2e results | |
if: ${{ steps.get-run-id.outputs.runId }} | |
run: | | |
echo "Downloading latest test results from run https://github.com/netlify/next-runtime/actions/runs/${{ steps.get-run-id.outputs.runId }}" | |
rm e2e-report/data/test-results.json | |
gh run download ${{ steps.get-run-id.outputs.runId }} -n "latest-test-results.json" -D e2e-report/data/ --repo $GITHUB_REPOSITORY | |
- name: Install site dependencies | |
if: success() | |
run: | | |
npm ci | |
working-directory: e2e-report | |
- name: Deploy e2e page | |
if: success() | |
run: | | |
ntl deploy --build --cwd e2e-report |