Skip to content

Commit

Permalink
feat: add github pages deployment to build workfow (#1)
Browse files Browse the repository at this point in the history
* use env for output dir

* add upload of build docs to gh-pages

* only run deploy on push on trunk
  • Loading branch information
assignUser authored Oct 28, 2024
1 parent 29eebc2 commit d929b6c
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ on:
pull_request:
branches: [ "trunk" ]

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.os }}

env:
LANG: en_US.UTF-8
build_output_dir: "${{ github.workspace }}/.build"

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
Expand Down Expand Up @@ -44,13 +48,6 @@ jobs:

- uses: flox/install-flox-action@v2

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/.build" >> "$GITHUB_OUTPUT"
- name: Run Maud
uses: flox/activate-action@v1
with:
Expand All @@ -64,12 +61,34 @@ jobs:
- name: Build
uses: flox/activate-action@v1
with:
command: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Debug
command: cmake --build ${{ env.build_output_dir }} --config Debug

- name: Test
uses: flox/activate-action@v1
with:
command: >
ctest --build-config Debug \
--test-dir ${{ steps.strings.outputs.build-output-dir }} \
--test-dir ${{ env.build_output_dir }} \
--output-on-failure
- name: Upload doc files
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.build_output_dir }}/documentation/dirhtml

deploy:
if: ${{ success() && github.event_name == 'push' && github.ref == 'trunk' }}
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit d929b6c

Please sign in to comment.