Skip to content

Commit

Permalink
chore: Update mdBook workflow to only upload and build once
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheworris committed Jul 24, 2024
1 parent 9a6eac4 commit 0fc38cc
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,26 @@ jobs:
uses: actions/checkout@v4

- name: Set up mdBook 📚
if: matrix.service == 'account' # Only upload mdbook once
uses: ./.github/workflows/common/set-up-mdbook
with:
token: ${{secrets.GITHUB_TOKEN}}
- name: Setup Pages
if: matrix.service == 'account' # Only setup Pages once
id: pages
uses: actions/configure-pages@v4

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

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
# Upload the mdBook output to GitHub Pages
- name: Upload mdbook to GitHub Pages
if: matrix.service == 'account' # Only upload mdbook once
uses: actions/upload-artifact@v3
with:
name: mdbook
path: ./docs/book

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

- name: Publish OpenAPI UI to GitHub Pages
- name: Upload OpenAPI UI to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
name: openapi-${{ matrix.service }}
path: ./docs/${{ matrix.service }}

# Deployment job
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download mdbook artifact
uses: actions/download-artifact@v3
with:
name: mdbook
path: ./docs/book

- name: Download account OpenAPI artifacts
uses: actions/download-artifact@v3
with:
name: openapi-account
path: ./docs/account

- name: Download content-watcher OpenAPI artifacts
uses: actions/download-artifact@v3
with:
name: openapi-content-watcher
path: ./docs/content-watcher

- name: Download content-publishing OpenAPI artifacts
uses: actions/download-artifact@v3
with:
name: openapi-content-publishing
path: ./docs/content-publishing

- name: Download graph OpenAPI artifacts
uses: actions/download-artifact@v3
with:
name: openapi-graph
path: ./docs/graph

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 0fc38cc

Please sign in to comment.