Skip to content

Commit 419ddde

Browse files
committed
feat: refactor workflow for Jekyll site to streamline build, test, and deploy stages
1 parent efeef68 commit 419ddde

1 file changed

Lines changed: 19 additions & 39 deletions

File tree

.github/workflows/jekyll.yml

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
# Combined workflow for testing and deploying Jekyll site to GitHub Pages
2-
# Tests must pass before deployment proceeds
3-
# Uses devcontainer for consistent environment between local dev and CI
1+
# Three-stage workflow: Build → Test → Deploy
2+
# Build: builds Jekyll site and uploads artifact
3+
# Test: runs Playwright tests, uploads results, never fails the pipeline
4+
# Deploy: deploys to GitHub Pages (skipped on pull requests)
45

5-
name: Test and Deploy Jekyll site to Pages
6+
name: Build, Test and Deploy Jekyll site to Pages
67

78
on:
8-
# Runs on pushes targeting the default branch
99
push:
1010
branches: ["master"]
1111
pull_request:
1212
branches: ["master"]
13-
14-
# Allows you to run this workflow manually from the Actions tab
1513
workflow_dispatch:
1614
inputs:
1715
update_snapshots:
@@ -20,24 +18,19 @@ on:
2018
default: false
2119
type: boolean
2220

23-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
2421
permissions:
2522
contents: read
2623
pages: write
2724
id-token: write
2825

29-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
30-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
3126
concurrency:
3227
group: "pages"
3328
cancel-in-progress: false
3429

3530
jobs:
36-
# Build job - uses devcontainer
31+
# Stage 1: Build - builds the Jekyll site and uploads the pages artifact
3732
build:
3833
runs-on: ubuntu-latest
39-
# Only build on push to master (not on PRs)
40-
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.update_snapshots)
4134
steps:
4235
- name: Checkout
4336
uses: actions/checkout@v4
@@ -56,15 +49,15 @@ jobs:
5649
env:
5750
JEKYLL_ENV: production
5851

59-
- name: Upload artifact
52+
- name: Upload pages artifact
6053
uses: actions/upload-pages-artifact@v3
6154

62-
# Test job - runs Playwright tests using devcontainer for consistent environment
55+
# Stage 2: Test - runs Playwright tests, uploads results, never fails
6356
test:
64-
timeout-minutes: 60
6557
runs-on: ubuntu-latest
6658
needs: build
67-
if: always() && !cancelled()
59+
continue-on-error: true
60+
timeout-minutes: 60
6861
steps:
6962
- name: Checkout
7063
uses: actions/checkout@v4
@@ -111,19 +104,19 @@ jobs:
111104

112105
- name: Upload Playwright Report
113106
uses: actions/upload-artifact@v4
114-
if: ${{ !cancelled() }}
107+
if: always()
115108
with:
116109
name: playwright-report
117110
path: playwright-report/
118-
retention-days: 30
111+
retention-days: 7
119112

120113
- name: Upload Test Results
121114
uses: actions/upload-artifact@v4
122-
if: ${{ !cancelled() }}
115+
if: always()
123116
with:
124117
name: test-results
125118
path: test-results/
126-
retention-days: 30
119+
retention-days: 7
127120

128121
- name: Upload Updated Snapshots
129122
uses: actions/upload-artifact@v4
@@ -133,30 +126,17 @@ jobs:
133126
path: |
134127
tests/**/*.png
135128
tests/**/*.txt
136-
retention-days: 30
129+
retention-days: 7
137130

138-
# Deployment job - only runs after build succeeds
131+
# Stage 3: Deploy - deploys to GitHub Pages (skipped on pull requests)
139132
deploy:
140-
if: needs.test.result == 'success' && needs.build.result == 'success'
133+
runs-on: ubuntu-latest
134+
needs: [build, test]
135+
if: github.event_name != 'pull_request'
141136
environment:
142137
name: github-pages
143138
url: ${{ steps.deployment.outputs.page_url }}
144-
runs-on: ubuntu-latest
145-
needs: [test, build]
146139
steps:
147140
- name: Deploy to GitHub Pages
148141
id: deployment
149142
uses: actions/deploy-pages@v4
150-
151-
# Deployment job when tests failed - requires manual approval
152-
deploy_manual:
153-
if: always() && needs.test.result == 'failure' && needs.build.result == 'success'
154-
environment:
155-
name: github-pages-approval
156-
url: ${{ steps.deployment.outputs.page_url }}
157-
runs-on: ubuntu-latest
158-
needs: [test, build]
159-
steps:
160-
- name: Deploy to GitHub Pages (manual approval)
161-
id: deployment
162-
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)