Skip to content

Commit

Permalink
Build and deploy site as part of CI
Browse files Browse the repository at this point in the history
  • Loading branch information
myedibleenso committed Sep 19, 2023
1 parent 4e07451 commit fe4ddee
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

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 }}

0 comments on commit fe4ddee

Please sign in to comment.