init preview builds for PRs #6
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
# .github/workflows/preview.yml | |
name: Deploy PR previews | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- closed | |
label: | |
types: | |
- preview | |
concurrency: preview-${{ github.ref }} | |
jobs: | |
deploy-preview: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: yarn | |
- name: Get submodules | |
run: git submodule init && git submodule update --remote --merge | |
- name: Install and Build | |
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed | |
env: | |
pr: ${{ github.event.number }} | |
run: | | |
echo "pr=$pr" >> $GITHUB_ENV | |
yarn install --frozen-lockfile | |
BASEURL='/pr-preview/pr-$pr' yarn build | |
- name: Deploy preview | |
uses: rossjrw/pr-preview-action@v1 | |
with: | |
source-dir: ./build/ |