Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add GitHub pages workflow #18

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
workflow_call:
inputs:
java-distribution:
description: The Java Distribution to use, default 'temurin'
required: false
type: string
default: temurin
java-version:
description: The Java Version to use, default '8'
required: false
type: string
default: 8
pages-directory:
description: Generated Github pages directory to upload
required: false
type: string
default: './target/docs/'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
submodules: 'recursive'

- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
cache: maven

- name: Verify
# build to generate docs folder
run: ./mvnw --batch-mode verify

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './target/docs/'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,31 @@ Gradle release workflow requires the following [Organization Secrets](https://gi
| `version-project` | For use with multi-module projects, this is used to determine application version | boolean | false | n/a | input |
| `pr-reviewers` | Users to be included in the post-release pull request | string | false | adesjardin, manikmagar, kkingavio | input |


### Publish docs to GitHub Pages

Create/Add a `.github/workflows/github-pages.yml` file within the project.

```yaml
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
# Temporary on current branch
push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
Build-Maven:
uses: avioconsulting/shared-workflows/.github/workflows/github-pages.yml@feat/add-github-pages
secrets: inherit
# with:
# java-distribution: temurin
# java-version: 8
# pages-directory: './target/docs'
```