Skip to content

Commit

Permalink
add PR preview concept
Browse files Browse the repository at this point in the history
  • Loading branch information
lubojr committed Sep 13, 2024
1 parent 3cfb18e commit cc8e1c9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ on:
- main
jobs:
deploy-preview:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
contents: write
pages: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/checkout@v4
- run: |
npm install
npm run docs:build -- --base /${{ github.event.repository.name }}/
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: .vitepress/dist/
branch: gh-pages
clean-exclude: pr-preview
force: false
37 changes: 37 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/preview.yml
# This is a basic workflow takes care of building and deploying
# client when creating merge request

name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed # pr-preview-action will do cleanup here, but build steps can be skipped

# do not allow running multiple of pipelines for this PR in parallel
concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-22.04
permissions:
contents: write
pages: write
pull-requests: write
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/checkout@v4
- if: github.event.action != 'closed'
run: |
npm install
npm run docs:build -- --base /${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}/
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: .vitepress/dist/

0 comments on commit cc8e1c9

Please sign in to comment.