Skip to content

Commit

Permalink
Add Preview Docs on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
haimlevy2006 committed Jun 29, 2024
1 parent 0476c96 commit 6416bcd
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 30 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/ci.yml.old

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/create-preview-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# name: Create Preview for PRs

# on:
# pull_request:
# branches:
# - master
# - v*.*

# env:
# PR_NUMBER: ${{ github.event.number }}

# jobs:
# comment-on-pr:
# runs-on: ubuntu-latest
# steps:
# - name: Comment on PR
# uses: hasura/[email protected]
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# repository: ${{ github.repository }}
# number: ${{ github.event.number }}
# id: deploy-preview
# message: "Starting deployment of preview ⏳..."

# create-preview:
# name: create preview
# runs-on: ubuntu-latest
# steps:
# - name: checkout latest
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: setup python
# uses: actions/setup-python@v5
# with:
# python-version: '3.9'
# cache: 'pip' # caching pip dependencies

# - name: install dependencies
# run: |
# pip3 install -r requirements.txt

# - name: Configure Git User
# run: |
# git config user.name "circleci-runai"
# git config user.email "[email protected]"

# - name: building preview
# run: |
# mike deploy ${{ env.PR_NUMBER }} ${{ env.PR_NUMBER }}-alias -t ${{ env.PR_NUMBER }} --prop-set hidden=true

# - name: Update comment
# uses: hasura/[email protected]
# if: github.ref != 'refs/heads/main'
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# repository: ${{ github.repository }}
# number: ${{ github.event.number }}
# id: deploy-preview
# message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ docs.run.ai/${{ env.PR_NUMBER }} ✨\n\n🚀 Happy reviewing! 🚀"
29 changes: 29 additions & 0 deletions .github/workflows/preview-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy PR previews

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

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

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

- name: Install and Build
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed
run: |
npm install
npm run build
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./site/

0 comments on commit 6416bcd

Please sign in to comment.