Skip to content

Commit

Permalink
Create gh-pages deploy actions (#18)
Browse files Browse the repository at this point in the history
* Create gh-pages-main.yml

* Add pr-preview.yml

* Add ghpages scripts

* Slight fix to ghpages scripts

* Add vite config

* Update gitignore

* Formatting

* Empty commit to trigger actions
  • Loading branch information
latonv committed Oct 6, 2022
1 parent 5720d85 commit 9a7d617
Show file tree
Hide file tree
Showing 6 changed files with 861 additions and 35 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/gh-pages-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will generate the static page under `main` subdirectory inside the `gh-pages` branch

# This workflow will run every time new changes were pushed to the `main` branch

name: App build CI/CD to main branch

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install dependencies
run: yarn install

- name: Create build files for gh-pages deploy
run: yarn ghpages:build

# Reference: https://github.com/JamesIves/github-pages-deploy-action
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages
folder: ghpages
clean-exclude: pr/
force: false
target-folder: main
token: ${{ secrets.GH_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will generate the static page under `pr` subdirectory inside the `gh-pages` branch

# This workflow will run every time there's a PR opened, reopened, synchronize, or closed

name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install and Build
run: |
yarn install
yarn ghpages:build
# Reference: https://github.com/rossjrw/pr-preview-action
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./ghpages/
umbrella-dir: pr
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
# build
/_site/
/dist/
/out-tsc/
/out-tsc/
/build/
ghpages
dist
dist-ssr
*.local
Loading

0 comments on commit 9a7d617

Please sign in to comment.