Skip to content

Commit

Permalink
Add PR preview deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt authored Sep 26, 2023
1 parent 6819c03 commit fbcd28c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Build Pull Request'
run-name: Build and upload preview for PR ${{ github.event.pull_request.number }}

on:
pull_request:
types: [synchronize, opened]

jobs:
build:
name: Build and upload site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.119.0"

- name: Build
run: hugo

- uses: matyrobbrt/cloudflare-pr-previews/upload@v1
name: Upload website
with:
build-dir: ./public/
24 changes: 24 additions & 0 deletions .github/workflows/preview-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Pull Request Previews'
run-name: Upload previews from workflow run ${{ github.event.workflow_run.id }}
on:
workflow_run:
workflows: [Build Pull Request]
types:
- completed

concurrency:
group: preview-pr
cancel-in-progress: false

jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: matyrobbrt/cloudflare-pr-previews@v1
with:
gh_app_key: ${{ secrets.CLOUDFLARE_PAGES_DEPLOYMENTS_GH_APP_KEY }}
gh_app_name: ${{ secrets.CLOUDFLARE_PAGES_DEPLOYMENTS_GH_APP_NAME }}
project_name: 'neoforged-website-previews'
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}

0 comments on commit fbcd28c

Please sign in to comment.