Skip to content

Commit

Permalink
Add predeploy on pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
firefoxic committed Dec 29, 2023
1 parent 15a7aa2 commit fd0f47e
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/predeploy-on-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Prepare for deploy on pull request

on:
pull_request_target:
branches:
- '*'

jobs:
predeploy-on-pull-request:
name: Predeploy on Pull Request

permissions:
contents: write

runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4
with:
ref: 'refs/pull/${{ github.event.pull_request.number }}/merge'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

- name: Restore cache
uses: actions/cache@v3
with:
path: ~/.npm
key: cache-npm-${{ hashFiles('./package-lock.json') }}
restore-keys: cache-npm-

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build
env:
REPO_NAME: ${{ github.event.repository.name }}
PR_NUMBER: ${{ github.event.pull_request.number }}

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./build
branch: gh-pages
target-folder: ${{ github.event.pull_request.number }}

0 comments on commit fd0f47e

Please sign in to comment.