Skip to content

Commit f841e03

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

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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: Build with Maven
45+
run: mvn -B --no-transfer-progress install -DskipTests
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Deploy documentation to GitHub Pages for version ${{ github.event.inputs.releaseversion }}
50+
uses: JamesIves/[email protected]
51+
with:
52+
branch: gh-pages
53+
folder: spring-boot-admin-docs/target/generated-docs
54+
target-folder: ${{ github.event.inputs.releaseversion }}
55+
clean: true
56+
57+
- name: Deploy redirect for /current to /${{ github.event.inputs.releaseversion }}
58+
uses: JamesIves/[email protected]
59+
if: github.event.inputs.copyDocsToCurrent == 'true'
60+
with:
61+
branch: gh-pages
62+
folder: spring-boot-admin-docs/target/generated-docs/current
63+
target-folder: /current
64+
clean: true
65+
66+
- name: Deploy deeplink redirect for /current/* to /${{ github.event.inputs.releaseversion }}/*
67+
uses: JamesIves/[email protected]
68+
if: github.event.inputs.copyDocsToCurrent == 'true'
69+
with:
70+
branch: gh-pages
71+
folder: spring-boot-admin-docs/target/generated-docs/current
72+
target-folder: /
73+
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)