chore: enable pr previews #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Sandbox PR Preview to GitHub Pages | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
# Ensure previews are cleaned up when PR is closed | |
- closed | |
# TODO: Update branch name to beta when needed | |
branches: | |
- alpha | |
concurrency: | |
group: sandbox-pr-preview-${{ github.ref }} | |
cancel-in-progress: true | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
pull-requests: write | |
jobs: | |
deploy-preview: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
# - name: Remove sandbox preview comment | |
# uses: marocchino/sticky-pull-request-comment@v2 | |
# with: | |
# header: sandbox_pr_preview | |
# delete: true | |
# GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build Sandbox | |
env: | |
# Tell the script to use the sandbox directory | |
USE_SANDBOX: true | |
run: yarn sandbox:build | |
- name: Deploy Sandbox PR Preview to GitHub Pages | |
uses: rossjrw/pr-preview-action@v1 | |
with: | |
source-dir: './sandbox/dist/' | |
preview-branch: alpha # ${{ github.head_ref || github.ref_name }} | |
umbrella-dir: pr-preview | |
token: ${{ secrets.KONGPONENTS_BOT_PAT }} | |
# - name: Provide sandbox preview link | |
# if: ${{ steps.pr-preview.outputs.deployment-url != '' }} | |
# uses: marocchino/sticky-pull-request-comment@v2 | |
# with: | |
# header: sandbox_pr_preview | |
# message: | | |
# ## Sandbox Deploy Preview | |
# ${{ steps.pr-preview.outputs.deployment-url }} | |
# GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }} |