I’ve been working on making a template repo for hosting an Express/Typescript server on Vercel. I originally started out with using the Github integration to automatically deploy my server, but after running into some issues found that I needed to switch to doing deployments via the Github action workflow recommended by Vercel in the documentation. This has worked for me, however because I previously set up the integration, I’m now in a state of having both the integration and the actions kicking off deployments, with only the action deployment working properly. I’m trying to figure out how to get out of this state and get my Vercel project and Github repo into a state as if I never added the integration and went with the CLI linking approach from the start, while keeping as much parity as possible with the integration capabilities.
On the Vercel side, what do I need to change? Do I just remove the “Connected Git Repository” repo link under “Settings > Git” or is there a reason I would want to keep that around? If keeping it around, what settings do I need to change to prevent all the deployment actions that happen from various repository interactions (change to “master”, branch push, pr against “master”, etc.)?
On the Github side, what do I need to change? Is there a way to view integrations for my repository and remove the Vercel one? I noticed I also have two environments configured in the repository, “Production” and “Production - (Vercel project name)”. I’m guessing the second one was added by the integration, but not sure if the first was as well or if that’s a Github default. Should I remove one or both? Is there anything else I might be unaware of the integration creating?
On parity with the integration, what should I cover? The documentation recommends setting up a production for pushes to “master” and a preview for pushes to every other branch, but I know the integration also creates previews for PR’s against “master”. I’m looking at changing the preview workflow to have optional PR only jobs that waits for the deployment, retrieves the preview URL, and comments similar to the integration, using this await action and url fetch action. Is there anything else I should cover, like somehow populating the deployments into the repositories “deployment” section? Or would that be somehow covered via the repo link on the Vercel side?
Any advice on how to effectively achieve any or all of this would be very appreciated.
Some people miss the deployment links in the comments and this is a way to replicate that feature with your custom workflow. Just make sure you save the deployment URL from the deploy command
Thanks for linking the documentation on git.deploymentEnabled; I saw a couple of people using that when I was doing research but didn’t see it on the vercel.json page, so I thought it might have been removed. Completely missed that there were nested pages in the sidebar. Also good to know that github cli is available in workflows, saw a lot of people using this action but definitely seems easier to use built-in git tooling.
I deleted the production - <vercel project name> environment and put it all together. So far I have:
The vercel deployment is now no longer happening, and the github-action is still happening and successfully deploying! For some reason, the line setting the preview-url as an output doesn’t seem to be triggering, leading to a deployment with no url attached. Will need to debug that and figure out why.
If anyone has any suggestions for improving this or what might be wrong with the workflow, would definitely appreciate the help, but thanks already for the great advice and helping me get this far!
Had a silly typo where I said the output production_url should be set to steps.production-deployment.outputs.preview_url, marking the previous reply as the solution but can’t edit it anymore. Gonna keep going with this , add db capabilities, then turn it into a template repo and post it under the Community tag for others to hopefully use.