name: github-pages on: push: branches: [main] jobs: main: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: { node-version: lts/*, cache: yarn } - name: Git config run: | git config user.name bot git config user.email bot@example git subtree add --prefix pages origin gh-pages - name: Build run: | yarn install yarn build - name: Publish run: | git add -f pages if git commit -m update; then git subtree push --prefix pages origin gh-pages fi