Skip to content

Commit

Permalink
Add await-for-vercel-deployment job
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadorequest committed Jan 16, 2021
1 parent 833c4e1 commit d5e7c1c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deploy-vercel-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,35 @@ jobs:
VERCEL_DEPLOYMENT_DOMAIN=${{ env.VERCEL_DEPLOYMENT_DOMAIN }}
GITHUB_PULL_REQUEST_ID=${{ steps.pr_id_finder.outputs.number }}
# Waits for the Vercel deployment to reach "READY" state, so that other actions will be applied on a domain that is really online
await-for-vercel-deployment:
name: Await current deployment to be ready (Ubuntu 18.04)
runs-on: ubuntu-18.04
needs: start-staging-deployment
steps:
- uses: actions/checkout@v1 # Get last commit pushed - See https://github.com/actions/checkout

# Restore variables stored by previous jobs
- name: Restore variables
uses: UnlyEd/[email protected] # See https://github.com/UnlyEd/github-action-store-variable
id: restore-variable
with:
variables: |
VERCEL_DEPLOYMENT_DOMAIN
# Wait for deployment to be ready, before running E2E (otherwise Cypress might start testing too early, and gets redirected to Vercel's "Login page", and tests fail)
- name: Awaiting Vercel deployment to be ready
uses: UnlyEd/[email protected] # See https://github.com/UnlyEd/github-action-await-vercel
id: await-vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEl_TOKEN }}
with:
deployment-url: ${{ fromJson(steps.restore-variable.outputs.variables).VERCEL_DEPLOYMENT_DOMAIN }} # Must only contain the domain name (no http prefix, etc.)
timeout: 90 # Wait for 90 seconds before failing

- name: Display deployment status
run: "echo The deployment is ${{ fromJson(steps.await-vercel.outputs.deploymentDetails).readyState }}"

# Runs E2E tests against the Vercel deployment
run-2e2-tests:
name: Run end to end (E2E) tests (Ubuntu 18.04)
Expand Down

0 comments on commit d5e7c1c

Please sign in to comment.