Deploy to Vercel with a GitHub Action
Deploying your website or web application to Vercel using GitHub Actions is a simple and efficient way to automate the deployment process.
Setting up the GitHub Action
To get started, you’ll need to create a new GitHub Action workflow file in your repository. You can do this by creating a new file in the .github/workflows
directory of your repository. Name the file something like vercel-deploy.yml
.
Next, you’ll need to add the following code to the workflow file to configure the GitHub Action:
name: Deploy to Vercel
on:
push:
branches:
- main # Change this to your main branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: amondnet/vercel-deployment@v1.0.2
with:
vercelToken: ${{ secrets.VERCEL_TOKEN }}
Make sure to replace main
with the name of your main branch and ${{ secrets.VERCEL_TOKEN }}
with your Vercel token, which you can obtain from your Vercel account settings.
Deploying to Vercel
Once you have configured the GitHub Action, any push to the main branch will trigger the deployment to Vercel. You can monitor the deployment status in the Actions tab of your repository on GitHub.
With this setup, you can easily automate the deployment process to Vercel whenever you push changes to your repository. This saves you time and effort, and ensures a smooth and consistent deployment process for your project.
Now that you have learned how to deploy to Vercel with a GitHub Action, you can streamline your deployment process and focus on building and improving your web projects.
Hi, where I get VERCEL_ORG_ID, VERCEL_PROJECT_ID, VERCEL_TOKEN from, please?
Can we do this for organization repos?
Boss
very helpful! thanks
Been searching for this tutorial for ages. You rock dude!
Keep up with the 🔥