Skip to content

Commit

Permalink
Publish GitHub pages with explicit GitHub Action Steps (#2461)
Browse files Browse the repository at this point in the history
This should, if it works, make the exact same website content that we currently have up on https://google.github.io/android-fhir/ appear.

What changes is that instead of GitHub "implicitly" building it for us, via its https://github.com/google/android-fhir/actions/workflows/pages/, we "control" it - which allows us hook our own documentation build steps into it.

All the magic GitHub Workflow Action YAML gobbledygook introduced here is inspired by https://github.com/enola-dev/enola/blob/ed2b1755b9dbf1a0668c86f80048d8bded94de4a/.github/workflows/ci.yaml#L131, where I learnt how to do this to create https://docs.enola.dev.
  • Loading branch information
vorburger committed Mar 6, 2024
1 parent 0467e57 commit ac5fd62
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,40 @@ jobs:
path: build.zip

# Steps that follow are related to the Documentation Web Site
# This deploys content based on docs/ which ends up in site/
# to https://google.github.io/android-fhir/ using GitHub Pages.

- name: Build Docs Site
# This 1st step intentionally runs not just on the main ("master") branch
# but also for all pull requests. This serves to detect doc breakages.
# (But the following steps, which do the actual deploy, only run for
# the main branch, of course.)
run: ./build-docs.bash

- name: Setup GitHub Pages
if: ${{ github.event_name == 'push' }}
uses: actions/configure-pages@v4

- name: Upload site/ directory as GitHub Pages artifact
if: ${{ github.event_name == 'push' }}
uses: actions/upload-pages-artifact@v3
with:
path: "site/"

deploy-website:
needs: build
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication
# Sets required permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# https://github.com/actions/deploy-pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit ac5fd62

Please sign in to comment.