Updated the Github Actions to deploy a test version of the site to a … #110
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: build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Checkout | |
uses: actions/checkout@v3 | |
- id: setup-jdk | |
name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: maven | |
- id: setup-ruby | |
name: Set up Ruby 3.0 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
- id: install-asciidoctor-pdf | |
name: Install asciidoctor-pdf | |
run: gem install asciidoctor-pdf | |
- id: build-docs | |
name: Build Docs | |
run: mvn -B clean package | |
- id: create-gh-pages-artifact | |
name: Create GitHub Pages Artifact | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: target/generated-docs | |
deploy: | |
name: Deploy to GitHub Pages | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- id: deployment | |
name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v2 | |
deploy_staging: | |
name: Deploy to Staging | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: staging | |
url: ${{ steps.staging_deployment.outputs.page_url }} | |
steps: | |
- id: staging_deployment | |
name: Deploy to Staging Folder on GitHub Pages | |
uses: actions/deploy-pages@v2 | |
with: | |
destination_dir: staging |