Skip to content

Commit af0f995

Browse files
authored
Bugfix/storm 67 (#70)
* Add versioned docs. (#67)
1 parent 71e3839 commit af0f995

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,45 @@ jobs:
5454
- name: Publish package to Maven Central
5555
run: mvn clean deploy -Prelease -Dgpg.passphrase="${GPG_PASSPHRASE}" -DskipTests -B
5656
env:
57-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
57+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
58+
59+
version-docs:
60+
runs-on: ubuntu-latest
61+
needs: publish
62+
steps:
63+
- name: Checkout main
64+
uses: actions/checkout@v4
65+
with:
66+
ref: main
67+
68+
- name: Set up Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: '22'
72+
cache: npm
73+
cache-dependency-path: website/package-lock.json
74+
75+
- name: Install website dependencies
76+
run: npm ci
77+
working-directory: website
78+
79+
- name: Extract version from tag
80+
id: version
81+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
82+
83+
- name: Create docs version
84+
run: npx docusaurus docs:version ${{ steps.version.outputs.VERSION }}
85+
working-directory: website
86+
87+
- name: Update default version in config
88+
run: |
89+
sed -i "s/lastVersion: '.*'/lastVersion: '${{ steps.version.outputs.VERSION }}'/" docusaurus.config.ts
90+
working-directory: website
91+
92+
- name: Commit and push
93+
run: |
94+
git config user.name "github-actions[bot]"
95+
git config user.email "github-actions[bot]@users.noreply.github.com"
96+
git add .
97+
git commit -m "docs: snapshot version ${{ steps.version.outputs.VERSION }}"
98+
git push

website/docusaurus.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ const config: Config = {
2828
path: '../docs',
2929
routeBasePath: '/',
3030
sidebarPath: './sidebars.ts',
31+
lastVersion: '1.9.0',
32+
versions: {
33+
current: {
34+
label: 'Next',
35+
path: 'next',
36+
},
37+
},
3138
editUrl: 'https://github.com/storm-repo/storm-framework/edit/main/docs/',
3239
},
3340
blog: false,
@@ -47,6 +54,10 @@ const config: Config = {
4754
srcDark: 'img/storm-light.png',
4855
},
4956
items: [
57+
{
58+
type: 'docsVersionDropdown',
59+
position: 'right',
60+
},
5061
{
5162
type: 'docSidebar',
5263
sidebarId: 'docs',

0 commit comments

Comments
 (0)