GitHub Actions for deploying to Netlify
Deploy URLs are commented on your pull requests and commit comments!
GitHub Deployments are also supported!
# .github/workflows/netlify.yml
name: Build and Deploy to Netlify
on:
push:
pull_request:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
# ( Build to ./dist or other directory... )
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './dist'
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: false
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
publish-dir
(e.g. "dist", "_site")NETLIFY_AUTH_TOKEN
: Personal access tokens > New access tokenNETLIFY_SITE_ID
: team page > your site > Settings > Site details > Site information > API ID- NOTE: API ID is
NETLIFY_SITE_ID
.
- NOTE: API ID is
production-branch
(e.g. "master")github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message
A custom deploy message to see on Netlify deployment (e.g.${{ github.event.pull_request.title }}
)enable-pull-request-comment: true
Comment on pull request (default: true)enable-commit-comment: true
Comment on GitHub commit (default: true)overwrites-pull-request-comment: true
Overwrites comment on pull request (default: true)netlify-config-path: ./netlify.toml
Path tonetlify.toml
(default: undefined)
deploy-url
A deployment URL generated by Netlify
npm ci
# NOTE: ./dist/typescript is generated automatically and causes type errors. (see: https://github.com/nwtgck/actions-netlify/issues/28)
rm -r dist
npm run all