The following excerpt is from a workflow that is triggered by a button click in my cms that sends a repository_dispatch event with a config-environment prop to my repo. Therefore, the workflow is implicitly running in the main branch where all repository_dispatch events are subscribed to, per GitHub docs. I am attempting to checkout staging and trigger a redeploy to my staging Preview domain in Vercel. But, the branch is not being picked up by Vercel as staging. In fact, what happens is it picks up a Preview build off of main (although from the latest staging commit).
# Create an aliased deployment on pushes to staging
deploy-staging:
name: Staging
# Run on pushes to the staging branch, if config-environment not set (i.e. not a redeploy)
# or if config-environment is set to 'staging' (i.e. a redeploy to staging)
# in which case we explicitly checkout the staging branch and deploy.
if: ${{ (github.ref == 'refs/heads/staging' && inputs.config-environment == '') || inputs.config-environment == 'staging' }}
runs-on: ubuntu-latest
steps:
- name: Checkout staging branch
uses: actions/checkout@v2
with:
ref: staging
- uses: amondnet/vercel-action@v20
with:
vercel-project-id: ${{ inputs.vercel-project-id }}
vercel-token: ${{ secrets.vercel-token }}
github-token: ${{ secrets.github-token }}
vercel-org-id: 'team_foo'
scope: 'team_foo'
alias-domains: ${{inputs.vercel-project}}-{{BRANCH}}.vercel.app
Ends up creating a preview: myproject-main.vercel.app
The following excerpt is from a workflow that is triggered by a button click in my cms that sends a
repository_dispatch
event with aconfig-environment
prop to my repo. Therefore, the workflow is implicitly running in themain
branch where allrepository_dispatch
events are subscribed to, per GitHub docs. I am attempting to checkoutstaging
and trigger a redeploy to my staging Preview domain in Vercel. But, the branch is not being picked up by Vercel as staging. In fact, what happens is it picks up a Preview build off of main (although from the latest staging commit).Ends up creating a preview:
myproject-main.vercel.app