This action will auto build and deploy to target branch when it get triggered.
Also it can preserve the history of gh-pages and convenient for rolling back to previous version.
And it will compare deployment file to previous version by using
git status --porcelain
, it will not to deploy if nothing change.
name: deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Build and Deploy
uses: ./.github/actions/deploy
env:
COMMIT_EMAIL: [email protected]
COMMIT_NAME: jeoy
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: master
DEPLOY_BRANCH: gh-pages
BUILD_SCRIPT: yarn && yarn build
FOLDER: build
param | description | required | default |
---|---|---|---|
COMMIT_NAME | The name who commit this deployment | false | ${GITHUB_ACTOR} |
COMMIT_EMAIL | The email who commit this deployment | true | - |
ACCESS_TOKEN | github token can acess repo | true | - |
BASE_BRANCH | The branch you want to build | false | master |
DEPLOY_BRANCH | The branch you want to deploy | false | gh-pages |
BUILD_SCRIPT | e.g. npm install && npm run build |
true | - |
FOLDER | The folder generated by build script | true | - |
When push to master
branch
This Action will run yarn && yarn build
Then push build
folder as a new commit on gh-pages
branch
note: mark sure
build
folder is on your gitignore list
checkout this entrypoint.sh