Skip to content

Commit 0fc38cc

Browse files
committed
chore: Update mdBook workflow to only upload and build once
1 parent 9a6eac4 commit 0fc38cc

File tree

1 file changed

+45
-5
lines changed

1 file changed

+45
-5
lines changed

.github/workflows/deploy-gh-pages.yaml

+45-5
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,26 @@ jobs:
3030
uses: actions/checkout@v4
3131

3232
- name: Set up mdBook 📚
33+
if: matrix.service == 'account' # Only upload mdbook once
3334
uses: ./.github/workflows/common/set-up-mdbook
3435
with:
3536
token: ${{secrets.GITHUB_TOKEN}}
3637
- name: Setup Pages
38+
if: matrix.service == 'account' # Only setup Pages once
3739
id: pages
3840
uses: actions/configure-pages@v4
3941

4042
- name: Build with mdBook
43+
if: matrix.service == 'account' # Only build mdbook once
4144
working-directory: docs
4245
run: mdbook build && ls book
4346

44-
- name: Upload artifact
45-
uses: actions/upload-pages-artifact@v3
47+
# Upload the mdBook output to GitHub Pages
48+
- name: Upload mdbook to GitHub Pages
49+
if: matrix.service == 'account' # Only upload mdbook once
50+
uses: actions/upload-artifact@v3
4651
with:
52+
name: mdbook
4753
path: ./docs/book
4854

4955
# Publish OpenAPI specs for each microservice
@@ -52,19 +58,53 @@ jobs:
5258
with:
5359
service: ${{ matrix.service }}
5460

55-
- name: Publish OpenAPI UI to GitHub Pages
61+
- name: Upload OpenAPI UI to GitHub Pages
5662
uses: actions/upload-pages-artifact@v3
5763
with:
64+
name: openapi-${{ matrix.service }}
5865
path: ./docs/${{ matrix.service }}
5966

6067
# Deployment job
6168
deploy:
69+
runs-on: ubuntu-latest
70+
needs: build
6271
environment:
6372
name: github-pages
6473
url: ${{ steps.deployment.outputs.page_url }}
65-
runs-on: ubuntu-latest
66-
needs: build
6774
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
78+
- name: Download mdbook artifact
79+
uses: actions/download-artifact@v3
80+
with:
81+
name: mdbook
82+
path: ./docs/book
83+
84+
- name: Download account OpenAPI artifacts
85+
uses: actions/download-artifact@v3
86+
with:
87+
name: openapi-account
88+
path: ./docs/account
89+
90+
- name: Download content-watcher OpenAPI artifacts
91+
uses: actions/download-artifact@v3
92+
with:
93+
name: openapi-content-watcher
94+
path: ./docs/content-watcher
95+
96+
- name: Download content-publishing OpenAPI artifacts
97+
uses: actions/download-artifact@v3
98+
with:
99+
name: openapi-content-publishing
100+
path: ./docs/content-publishing
101+
102+
- name: Download graph OpenAPI artifacts
103+
uses: actions/download-artifact@v3
104+
with:
105+
name: openapi-graph
106+
path: ./docs/graph
107+
68108
- name: Deploy to GitHub Pages
69109
id: deployment
70110
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)