DOC: Issue-118 - added workflow for building and deploying the homepage. #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: homepage | |
on: | |
workflow_dispatch: # manual trigger | |
inputs: | |
run-testenv: | |
description: "Run the build and deployment process of the OpenDuT homepage." | |
required: false | |
type: string | |
default: "false" | |
pull_request: | |
types: [ opened, reopened, synchronize, edited, ready_for_review ] | |
push: | |
branches: [ | |
"main", | |
"development" | |
] | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
- v[0-9]+.[0-9]+.[0-9]+-* | |
jobs: | |
check_documentation_changed: | |
name: Check if documentation has changed and a new deploy is needed | |
runs-on: ${{ fromJson(inputs.runs-on) }} | |
outputs: | |
documentation: ${{ steps.filter.outputs.documentation }} | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # https://github.com/dorny/paths-filter/tree/v3.0.2 | |
id: filter | |
with: | |
filters: | | |
documentation: | |
- 'doc/**' | |
- 'opendut-homepage/**' | |
base: main | |
build_homepage: | |
name: Build the homepage and upload artifact | |
if: ${{ needs.check_documentation_changed.outputs.documentation == 'true' }} | |
runs-on: ${{ fromJson(inputs.runs-on) }} | |
needs: check_documentation_changed | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
- name: Configure GitHub Pages | |
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b | |
- name: Rust setup | |
uses: ./.github/actions/rust-setup | |
- name: Build homepage | |
run: cargo ci doc homepage build | |
- name: Upload homepage artifact | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 | |
with: | |
name: "homepage" | |
path: "./target/ci/homepage" | |
if-no-files-found: error | |
retention-days: 1 | |
- name: Upload GitHub Pages artifact | |
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa | |
with: | |
path: "./target/ci/homepage" | |
deploy_homepage: | |
name: Deploy the created homepage artifacts to GitHub Pages | |
if: ${{ needs.check_documentation_changed.outputs.documentation == 'true' }} | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
runs-on: ${{ fromJson(inputs.runs-on) }} | |
needs: build_homepage | |
environment: | |
name: github-pages | |
url: ${{steps.deployment.outputs.page_url}} | |
steps: | |
- name: Deploy artifact | |
id: deployment | |
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e |