[CI] Build and deploy site as part of CI #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# see https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-gatsby | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
# deps | |
#- run: sudo yarn global add <pkg>@^<version> --prefix /usr/local | |
#- run: yarn add <pkg>@^<version> | |
# install deps | |
- run: yarn install | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
#- run: npm ci | |
- run: npm run build | |
- name: Deploy | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
# see https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: ${{ github.event.head_commit.message }} | |