Skip to content

Commit

Permalink
fix: deployment of documentation (#4023)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteKoe committed Feb 10, 2025
1 parent ea58cdd commit 0a048f5
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 2 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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
4 changes: 2 additions & 2 deletions spring-boot-admin-docs/src/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build:current-version-redirect": "sed \"s/@@VERSION@@/$VERSION/g\" current/index.template.html > current/index.html && sed \"s/@@VERSION@@/$VERSION/g\" current/404.template.html > current/404.html",
"build:current-version-redirect": "mkdir -p build/current/ && sed \"s/@@VERSION@@/$VERSION/g\" current/index.template.html > build/current/index.html && sed \"s/@@VERSION@@/$VERSION/g\" current/404.template.html > build/current/404.html",
"build": "docusaurus build",
"build:prod": "npm run build && npm run build:current-version-redirect && rm -rf ../../target/generated-docs && mv ./build ../../target/generated-docs"
"build:prod": "npm run build && npm run build:current-version-redirect && mv ./build ../../target/generated-docs"
},
"dependencies": {
"@docusaurus/core": "^3.6.3",
Expand Down

0 comments on commit 0a048f5

Please sign in to comment.