Skip to content

Commit

Permalink
ci: Change PR preview environment
Browse files Browse the repository at this point in the history
  • Loading branch information
widal001 committed Dec 30, 2024
1 parent 52a1be8 commit 967fed3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/cd-website-preview.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy PR preview to GitHub Pages
name: CD - Website (PR preview)

on:
pull_request:
Expand All @@ -14,6 +14,10 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest

# Skip job if the PR is from a fork
if: github.event.pull_request.head.repo.full_name == github.repository

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -29,10 +33,12 @@ jobs:
deploy:
needs: build
runs-on: ubuntu-latest
# Uses the same github-pages environment, but GitHub Pages automatically
# associates the deployment with the PR number instead of the default production URL.

# Skip job if the PR is from a fork
if: github.event.pull_request.head.repo.full_name == github.repository

environment:
name: github-pages
name: github-pages-preview # Use the new environment for PR previews
url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/
steps:
- name: Deploy to GitHub Pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-website.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to GitHub Pages
name: CD - Website (main)

on:
# Trigger the workflow every time we push to the `main` branch
Expand Down

0 comments on commit 967fed3

Please sign in to comment.