Skip to content

Commit b823085

Browse files
authored
feat: refactor Jekyll workflow to run build job before tests and simplify manual deployment conditions
1 parent c114a66 commit b823085

1 file changed

Lines changed: 29 additions & 28 deletions

File tree

.github/workflows/jekyll.yml

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,38 @@ concurrency:
3333
cancel-in-progress: false
3434

3535
jobs:
36+
# Build job - uses devcontainer
37+
build:
38+
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)
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Setup Pages
46+
id: pages
47+
uses: actions/configure-pages@v5
48+
49+
- name: Build with Jekyll in devcontainer
50+
uses: devcontainers/ci@v0.3
51+
with:
52+
push: never
53+
runCmd: |
54+
bundle install
55+
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
56+
env:
57+
JEKYLL_ENV: production
58+
59+
- name: Upload artifact
60+
uses: actions/upload-pages-artifact@v3
61+
3662
# Test job - runs Playwright tests using devcontainer for consistent environment
3763
test:
3864
timeout-minutes: 60
3965
runs-on: ubuntu-latest
66+
needs: build
67+
if: always() && !cancelled()
4068
steps:
4169
- name: Checkout
4270
uses: actions/checkout@v4
@@ -107,33 +135,6 @@ jobs:
107135
tests/**/*.txt
108136
retention-days: 30
109137

110-
# Build job - uses devcontainer, only runs after tests pass
111-
build:
112-
runs-on: ubuntu-latest
113-
needs: test
114-
# Only build on push to master (not on PRs)
115-
if: always() && !cancelled() && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.update_snapshots))
116-
steps:
117-
- name: Checkout
118-
uses: actions/checkout@v4
119-
120-
- name: Setup Pages
121-
id: pages
122-
uses: actions/configure-pages@v5
123-
124-
- name: Build with Jekyll in devcontainer
125-
uses: devcontainers/ci@v0.3
126-
with:
127-
push: never
128-
runCmd: |
129-
bundle install
130-
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
131-
env:
132-
JEKYLL_ENV: production
133-
134-
- name: Upload artifact
135-
uses: actions/upload-pages-artifact@v3
136-
137138
# Deployment job - only runs after build succeeds
138139
deploy:
139140
if: needs.test.result == 'success' && needs.build.result == 'success'
@@ -149,7 +150,7 @@ jobs:
149150

150151
# Deployment job when tests failed - requires manual approval
151152
deploy_manual:
152-
if: needs.test.result == 'failure' && needs.build.result == 'success'
153+
if: needs.test.result == 'failure'
153154
environment:
154155
name: github-pages-approval
155156
url: ${{ steps.deployment.outputs.page_url }}

0 commit comments

Comments
 (0)