API Setting > Webhook > Add > GitHub Actions
Settings Developer settings https://github.com/settings/apps
Personal access tokens (classic)
Generate new token
some check and generate token. And copy.
Repository > Settings > Security > Secrets > Actions
name: CI
on:
push:
branches:
- master
repository_dispatch:
types: [update_site]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Github Checkout master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "*@gmail.com"
git config --global user.name "deploy"
git checkout master
git pull origin master
- name: Generate static page
run: npm run generate
env:
MICROCMS_API_KEY: ${{ secrets.MICROCMS_API_KEY }}
MICROCMS_SERVICE_DOMAIN: ${{ secrets.MICROCMS_SERVICE_DOMAIN }}
- name: Copy Files .output/public to docs
run: |
rm -rf docs
mkdir docs
shopt -s dotglob
cp -r -p .output/public/* docs
- name: Deploy to Github Page
run: |
git add .
git commit -m 'deploy'
git push origin master