Skip to content

Commit 4bad223

Browse files
Fix deployments across staging and production.
Fixes 404 errors and build issues in the staging and production environments. * Remove Repo Name from baseurl for Staging Deployments * Add Deploy Script for GH Pages to manage production deployments
1 parent c25b675 commit 4bad223

2 files changed

Lines changed: 75 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
7+
name: Deploy to GitHib Pages
8+
9+
on:
10+
# Runs on pushes targeting the default branch
11+
push:
12+
branches: ["main"]
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
23+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: false
28+
29+
30+
jobs:
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Ruby
39+
# https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
40+
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
41+
with:
42+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
43+
cache-version: 0 # Increment this number if you need to re-download cached gems
44+
45+
- uses: actions/setup-node@v4
46+
- name: Install Node Dependencies
47+
run: npm install
48+
49+
- name: Setup Pages
50+
id: pages
51+
uses: actions/configure-pages@v5
52+
- name: Build with Jekyll & Gulp
53+
# Outputs to the './_site' directory by default
54+
run: gulp build && bundle exec jekyll build
55+
env:
56+
JEKYLL_ENV: production
57+
- name: Upload artifact
58+
# Automatically uploads an artifact from the './_site' directory by default
59+
uses: actions/upload-pages-artifact@v3
60+
61+
# Deployment job
62+
deploy:
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
runs-on: ubuntu-latest
67+
needs: build
68+
steps:
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v4
72+
with:
73+
clean-exclude: pr-preview/

.github/workflows/preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- run: echo "PREVIEW_PATH=pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"
3030

31-
- name: Set Repo Name
31+
- name: Set Repo Name # Set in case the custom domain is not configured and the repo name needs to be added to the baseurl
3232
run: |
3333
REPO_NAME="${GITHUB_REPOSITORY##*/}"
3434
echo "REPO_NAME=$REPO_NAME" >> "$GITHUB_ENV"
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Install and Build
4848
if: github.event.action != 'closed' # Skip the build if the PR has been closed
49-
run: gulp build && bundle exec jekyll build --baseurl "/${{ env.REPO_NAME }}/pr-preview/pr-${{ github.event.number }}"
49+
run: gulp build && bundle exec jekyll build --baseurl "/pr-preview/pr-${{ github.event.number }}"
5050
env:
5151
JEKYLL_ENV: preview
5252

0 commit comments

Comments
 (0)