Skip to content

Commit

Permalink
chore: Add preview build and update pages site deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrderyk committed Mar 5, 2024
1 parent a5e480e commit d53d9ea
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 37 deletions.
52 changes: 15 additions & 37 deletions .github/workflows/deploy-pages-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,27 @@ on:
branches: [main]

permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

contents: write
jobs:
# Build job
build:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup Pages
uses: actions/configure-pages@v1

- name: Install Dependencies
run: npm install

- name: Build react-search Package
run: npm run build
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
npm ci
npm run build
- name: Build Page Script
run: npm run buildDocs
run: |
npm i --prefix docs/
npm run buildDocs --prefix docs/
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
# Everything in this folder will be uploaded as the GitHub page
path: "docs/public"

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
folder: docs/public # The folder the action should deploy.
clean-exclude: pr-preview/
23 changes: 23 additions & 0 deletions .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .github/workflows/preview.yml
name: Deploy PR preview
concurrency: preview-${{ github.ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm i && npm run build && npm i --prefix docs/ && npm run buildDocs --prefix docs/
if: github.event.action != 'closed'
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/public
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto

0 comments on commit d53d9ea

Please sign in to comment.