,

Using a GitHub Action to Deploy to Vercel

Posted by

Deploy to Vercel with a GitHub Action

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.

0 0 votes
Article Rating
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@LavidadeLi
11 months ago

Hi, where I get VERCEL_ORG_ID, VERCEL_PROJECT_ID, VERCEL_TOKEN from, please?

@SanjayKumar-st2pb
11 months ago

Can we do this for organization repos?

@webdeveloperninja9220
11 months ago

Boss

@martindimitrov8547
11 months ago

very helpful! thanks

@thesobercoder
11 months ago

Been searching for this tutorial for ages. You rock dude!

@richardsifeanyi6766
11 months ago

Keep up with the 🔥