📖 Deploy Documentation #2
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: 📖 Deploy Documentation | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseversion: | |
description: 'Release version' | |
required: true | |
default: '3.0.0' | |
copyDocsToCurrent: | |
description: "Should the docs be published at https://docs.spring-boot-admin.com? Otherwise they will be accessible by version number only." | |
required: true | |
type: boolean | |
default: false | |
env: | |
VERSION: ${{ github.event.inputs.releaseversion }} | |
jobs: | |
deploy-documentation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Set projects Maven version to GitHub Action GUI set version | |
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress | |
- name: Build with Maven | |
run: mvn -B --no-transfer-progress install -DskipTests | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy documentation to GitHub Pages for version ${{ github.event.inputs.releaseversion }} | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: spring-boot-admin-docs/target/generated-docs | |
target-folder: ${{ github.event.inputs.releaseversion }} | |
clean: true | |
- name: Deploy redirect for /current to /${{ github.event.inputs.releaseversion }} | |
uses: JamesIves/[email protected] | |
if: github.event.inputs.copyDocsToCurrent == 'true' | |
with: | |
branch: gh-pages | |
folder: spring-boot-admin-docs/target/generated-docs/current | |
target-folder: /current | |
clean: true | |
- name: Deploy deeplink redirect for /current/* to /${{ github.event.inputs.releaseversion }}/* | |
uses: JamesIves/[email protected] | |
if: github.event.inputs.copyDocsToCurrent == 'true' | |
with: | |
branch: gh-pages | |
folder: spring-boot-admin-docs/target/generated-docs/current | |
target-folder: / | |
clean: false |