Skip to content

Commit 0a048f5

Browse files
committed
fix: deployment of documentation (#4023)
1 parent ea58cdd commit 0a048f5

File tree

2 files changed

+78
-2
lines changed

2 files changed

+78
-2
lines changed
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 📖 Deploy Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseversion:
7+
description: 'Release version'
8+
required: true
9+
default: '3.0.0'
10+
copyDocsToCurrent:
11+
description: "Should the docs be published at https://docs.spring-boot-admin.com? Otherwise they will be accessible by version number only."
12+
required: true
13+
type: boolean
14+
default: false
15+
env:
16+
VERSION: ${{ github.event.inputs.releaseversion }}
17+
18+
jobs:
19+
deploy-documentation:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up JDK 17
26+
uses: actions/setup-java@v4
27+
with:
28+
distribution: 'temurin'
29+
java-version: '17'
30+
cache: 'maven'
31+
32+
- name: Cache node modules
33+
uses: actions/cache@v4
34+
env:
35+
cache-name: cache-node-modules
36+
with:
37+
path: ~/.npm
38+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-build-${{ env.cache-name }}-
41+
${{ runner.os }}-build-
42+
${{ runner.os }}-
43+
44+
- name: Set projects Maven version to GitHub Action GUI set version
45+
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
46+
47+
- name: Build with Maven
48+
run: mvn -B --no-transfer-progress install -DskipTests
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Deploy documentation to GitHub Pages for version ${{ github.event.inputs.releaseversion }}
53+
uses: JamesIves/[email protected]
54+
with:
55+
branch: gh-pages
56+
folder: spring-boot-admin-docs/target/generated-docs
57+
target-folder: ${{ github.event.inputs.releaseversion }}
58+
clean: true
59+
60+
- name: Deploy redirect for /current to /${{ github.event.inputs.releaseversion }}
61+
uses: JamesIves/[email protected]
62+
if: github.event.inputs.copyDocsToCurrent == 'true'
63+
with:
64+
branch: gh-pages
65+
folder: spring-boot-admin-docs/target/generated-docs/current
66+
target-folder: /current
67+
clean: true
68+
69+
- name: Deploy deeplink redirect for /current/* to /${{ github.event.inputs.releaseversion }}/*
70+
uses: JamesIves/[email protected]
71+
if: github.event.inputs.copyDocsToCurrent == 'true'
72+
with:
73+
branch: gh-pages
74+
folder: spring-boot-admin-docs/target/generated-docs/current
75+
target-folder: /
76+
clean: false

spring-boot-admin-docs/src/site/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"scripts": {
66
"docusaurus": "docusaurus",
77
"start": "docusaurus start",
8-
"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",
8+
"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",
99
"build": "docusaurus build",
10-
"build:prod": "npm run build && npm run build:current-version-redirect && rm -rf ../../target/generated-docs && mv ./build ../../target/generated-docs"
10+
"build:prod": "npm run build && npm run build:current-version-redirect && mv ./build ../../target/generated-docs"
1111
},
1212
"dependencies": {
1313
"@docusaurus/core": "^3.6.3",

0 commit comments

Comments
 (0)