Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to deploy to staging from a workflow triggered by repository_dispatch #259

Open
jeromecovington opened this issue Jun 27, 2024 · 0 comments

Comments

@jeromecovington
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant