You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Deploy static site to Netlify or Vercel
v1.1.1
This GitHub Action deploys your static site to Netlify or Vercel by triggering a build hook from the convenience of your GitHub repository. You can also set it up to run by cron.
The Action will skip deployment when no changes are detected since the last run. To store the commit id of the current deployment GitHub cache mechanism is used.
You can also pass always_deploy
set to true
to trigger deployment without checking for changes.
To obtain build hook URL:
- Sign in with Netlify.
- Select the site you want to deploy. Go to Site configuration.
- Select Build & deploy.
- Scroll down to Build hooks and click Add build hook.
- Enter a descriptive name of your hook and click Save.
- Your webook URL has the following format:
https://api.netlify.com/build_hooks/12345679abcdef
. You shouldn't share it with anyone else. I recommend saving it in Secrets and variables section of your GitHub repository settings. - Create your workflow as follows:
name: Deploy static site
on:
workflow_dispatch:
jobs:
DeploySite:
runs-on: ubuntu-latest
steps:
- name: Deploy site
uses: lwojcik/github-action-deploy-static-site@v1
with:
platform: netlify
netlify_deploy_hook_url: ${{ secrets.NETLIFY_DEPLOY_HOOK_URL }}
# always_deploy: true - if you want to skip checking for changes
To disable automatic builds and obtain build hook URL:
- Sign in with Vercel.
- Select the project you want to deploy. Go to Settings.
- Select Git. Head to Deploy Hooks section and create a new hook.
- Your webhook URL has the following format:
https://api.vercel.com/v1/integrations/deploy/12345679abcdef
. You shouldn't share it with anyone else. I recommend saving it in Secrets and variables section of your GitHub repository settings. - Create your workflow as follows:
name: Deploy static site
on:
workflow_dispatch:
jobs:
DeploySite:
runs-on: ubuntu-latest
steps:
- name: Deploy site
uses: lwojcik/github-action-deploy-static-site@v1
with:
platform: vercel
vercel_deploy_hook_url: ${{ secrets.VERCEL_DEPLOY_HOOK_URL }}
# always_deploy: true - if you want to skip checking for changes
Licensed under MIT License. See LICENSE for more information.