Skip to content

Commit c8f369e

Browse files
Update readme sync actions to trigger a new version publishing on the server
Changelog-Added: The Documentation Portal now retains and organizes documentation according to individual release versions.
1 parent a3a9e89 commit c8f369e

2 files changed

Lines changed: 174 additions & 32 deletions

File tree

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,100 @@
1-
name: ReadMe Sync
1+
name: ReadMe Docs Sync
22

33
on:
44
push:
55
branches:
66
- 'master'
77
paths:
88
- 'doc/**'
9+
tags:
10+
- 'v[0-9]+.[0-9]+'
11+
- 'v[0-9]+.[0-9]+.[0-9]+'
12+
- 'v[0-9]+.[0-9]+[0-9a-z]+'
913
workflow_dispatch:
1014

1115
jobs:
12-
rdme-docs-sync:
13-
runs-on: ubuntu-22.04
16+
# Step 1: Determine version and create ReadMe version if needed
17+
version:
18+
name: Determine ReadMe Version
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
readme_version: ${{ steps.determine.outputs.readme_version }}
22+
version_created: ${{ steps.create_version.outputs.readme_version_created }}
1423
steps:
1524
- name: Check out repo 📚
1625
uses: actions/checkout@v6
1726

27+
- name: Determine version from .version file
28+
id: determine
29+
run: |
30+
if [ -f .version ]; then
31+
FULL_VERSION=$(cat .version | tr -d ' \n')
32+
VERSION="${FULL_VERSION#v}"
33+
SHORT_VERSION=$(echo "$VERSION" | grep -oE '^[0-9]+\.[0-9]+')
34+
echo "Full version: $FULL_VERSION"
35+
echo "Short version: $SHORT_VERSION"
36+
echo "readme_version=${SHORT_VERSION}" >> "$GITHUB_OUTPUT"
37+
else
38+
echo "No .version file found, using 'stable'"
39+
echo "readme_version=stable" >> "$GITHUB_OUTPUT"
40+
fi
41+
42+
- name: Create ReadMe version if needed
43+
id: create_version
44+
if: github.ref_type == 'tag'
45+
run: |
46+
bash .github/scripts/create-readme-version.sh "${{ steps.determine.outputs.readme_version }}"
47+
env:
48+
README_API_KEY: ${{ secrets.README_API_KEY }}
49+
50+
# Step 2: Sync docs to the determined version
51+
rdme-docs-sync:
52+
name: Sync Docs to ReadMe
53+
needs: version
54+
runs-on: ubuntu-24.04
55+
steps:
56+
- name: Check out repo 📚
57+
uses: actions/checkout@v6
58+
59+
- name: Read version for sync
60+
id: sync_version
61+
run: |
62+
README_VERSION="${{ needs.version.outputs.readme_version }}"
63+
if [ -z "$README_VERSION" ] || [ "$README_VERSION" = "null" ]; then
64+
if [ -f .version ]; then
65+
FULL_VERSION=$(cat .version | tr -d ' \n')
66+
VERSION="${FULL_VERSION#v}"
67+
README_VERSION=$(echo "$VERSION" | grep -oE '^[0-9]+\.[0-9]+')
68+
else
69+
README_VERSION="stable"
70+
fi
71+
fi
72+
echo "Syncing to ReadMe version: ${README_VERSION}"
73+
echo "version=${README_VERSION}" >> "$GITHUB_OUTPUT"
1874
- name: Sync doc/getting-started/ 🚀
1975
uses: readmeio/rdme@v10
2076
with:
21-
rdme: docs upload ./doc/getting-started --key=${{ secrets.README_API_KEY }} --branch=1
22-
77+
rdme: docs upload ./doc/getting-started --key=${{ secrets.README_API_KEY }} --branch=${{ steps.sync_version.outputs.version }}
78+
2379
- name: Sync doc/beginners-guide/ 🚀
2480
uses: readmeio/rdme@v10
2581
with:
26-
rdme: docs upload ./doc/beginners-guide --key=${{ secrets.README_API_KEY }} --branch=1
82+
rdme: docs upload ./doc/beginners-guide --key=${{ secrets.README_API_KEY }} --branch=${{ steps.sync_version.outputs.version }}
2783

2884
- name: Sync doc/node-operators-guide/ 🚀
2985
uses: readmeio/rdme@v10
3086
with:
31-
rdme: docs upload ./doc/node-operators-guide --key=${{ secrets.README_API_KEY }} --branch=1
87+
rdme: docs upload ./doc/node-operators-guide --key=${{ secrets.README_API_KEY }} --branch=${{ steps.sync_version.outputs.version }}
3288

3389
- name: Sync doc/developers-guide/ 🚀
3490
uses: readmeio/rdme@v10
3591
with:
36-
rdme: docs upload ./doc/developers-guide --key=${{ secrets.README_API_KEY }} --branch=1
37-
92+
rdme: docs upload ./doc/developers-guide --key=${{ secrets.README_API_KEY }} --branch=${{ steps.sync_version.outputs.version }}
93+
3894
- name: Sync doc/contributing-to-core-lightning/ 🚀
3995
uses: readmeio/rdme@v10
4096
with:
41-
rdme: docs upload ./doc/contribute-to-core-lightning --key=${{ secrets.README_API_KEY }} --branch=1
97+
rdme: docs upload ./doc/contribute-to-core-lightning --key=${{ secrets.README_API_KEY }} --branch=${{ steps.sync_version.outputs.version }}
98+
99+
# Note: Promotion to stable is handled in readme-rpc-sync.yml to avoid race
100+
# conditions between the two workflows publishing to the same ReadMe project.

.github/workflows/readme-rpc-sync.yml

Lines changed: 105 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,119 @@ on:
1313
- 'doc/*.8.md'
1414
- 'doc/lightningd-*.7.md'
1515
- 'doc/reckless.7.md'
16+
tags:
17+
- 'v[0-9]+.[0-9]+'
18+
- 'v[0-9]+.[0-9]+.[0-9]+'
19+
- 'v[0-9]+.[0-9]+[0-9a-z]+'
1620
workflow_dispatch:
1721

1822
jobs:
23+
# Step 1: Determine version and create ReadMe version if needed
24+
version:
25+
name: Determine ReadMe Version
26+
runs-on: ubuntu-24.04
27+
outputs:
28+
readme_version: ${{ steps.determine.outputs.readme_version }}
29+
version_created: ${{ steps.create_version.outputs.readme_version_created }}
30+
steps:
31+
- name: Check out repo 📚
32+
uses: actions/checkout@v6
33+
34+
- name: Determine version from .version file
35+
id: determine
36+
run: |
37+
FULL_VERSION=$(cat .version | tr -d ' \n')
38+
VERSION="${FULL_VERSION#v}"
39+
SHORT_VERSION=$(echo "$VERSION" | grep -oE '^[0-9]+\.[0-9]+')
40+
echo "Full version: $FULL_VERSION"
41+
echo "Short version: $SHORT_VERSION"
42+
echo "readme_version=${SHORT_VERSION}" >> "$GITHUB_OUTPUT"
43+
44+
- name: Create ReadMe version if needed
45+
id: create_version
46+
if: github.ref_type == 'tag'
47+
run: |
48+
bash .github/scripts/create-readme-version.sh "${{ steps.determine.outputs.readme_version }}"
49+
env:
50+
README_API_KEY: ${{ secrets.README_API_KEY }}
51+
52+
# Step 2: Build and sync RPC docs to the determined version
1953
rdme-rpc-sync:
20-
runs-on: ubuntu-22.04
54+
name: Sync RPC Docs to ReadMe
55+
needs: version
56+
runs-on: ubuntu-24.04
2157
steps:
22-
- name: Checkout repository
23-
uses: actions/checkout@v6
58+
- name: Checkout repository
59+
uses: actions/checkout@v6
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v6
63+
with:
64+
python-version: 3.9
65+
66+
- name: Install python modules
67+
run: |
68+
python -m pip install requests mako grpcio-tools
2469
25-
- name: Set up Python
26-
uses: actions/setup-python@v6
27-
with:
28-
python-version: 3.9
70+
- name: Install uv
71+
uses: astral-sh/setup-uv@v8.1.0
2972

30-
- name: Install python modules
31-
run: |
32-
python -m pip install requests mako grpcio-tools
73+
- name: Install dependencies
74+
run: bash -x .github/scripts/setup.sh
75+
76+
- name: Build (including rpc .md files)
77+
run: |
78+
./configure --enable-debugbuild
79+
make -j $(nproc)
80+
81+
- name: Determine ReadMe version for sync
82+
id: sync_version
83+
run: |
84+
README_VERSION="${{ needs.version.outputs.readme_version }}"
85+
if [ -z "$README_VERSION" ] || [ "$README_VERSION" = "null" ]; then
86+
if [ -f .version ]; then
87+
FULL_VERSION=$(cat .version | tr -d ' \n')
88+
VERSION="${FULL_VERSION#v}"
89+
README_VERSION=$(echo "$VERSION" | grep -oE '^[0-9]+\.[0-9]+')
90+
else
91+
README_VERSION="stable"
92+
fi
93+
fi
94+
echo "Syncing RPC docs to ReadMe version: ${README_VERSION}"
95+
echo "version=${README_VERSION}" >> "$GITHUB_OUTPUT"
96+
97+
- name: Set environment variable and run
98+
env:
99+
README_API_KEY: ${{ secrets.README_API_KEY }}
100+
README_VERSION: ${{ steps.sync_version.outputs.version }}
101+
run: python .github/scripts/sync-rpc-cmds.py
102+
103+
# Step 3: Set as stable version after sync (for full releases, not RC)
104+
promote:
105+
name: Promote to Stable
106+
needs:
107+
- version
108+
- rdme-rpc-sync
109+
if: >
110+
github.ref_type == 'tag' &&
111+
needs.version.outputs.version_created == 'true' && !contains(github.ref_name, 'rc')
112+
runs-on: ubuntu-24.04
113+
steps:
114+
- name: Check out repo 📚
115+
uses: actions/checkout@v6
33116

34-
- name: Install uv
35-
uses: astral-sh/setup-uv@v8.1.0
117+
- name: Promote version to stable
118+
run: |
119+
README_VERSION="${{ needs.version.outputs.readme_version }}"
120+
echo "Promoting '${README_VERSION}' to stable..."
36121
37-
- name: Install dependencies
38-
run: bash -x .github/scripts/setup.sh
122+
curl -s -X PUT "https://api.readme.com/v2/versions/${README_VERSION}" \
123+
-H "Authorization: Bearer ${{ secrets.README_API_KEY }}" \
124+
-H "Content-Type: application/json" \
125+
-d '{
126+
"is_stable": true
127+
}'
39128
40-
- name: Build (including rpc .md files)
41-
run: |
42-
./configure --enable-debugbuild
43-
make -j $(nproc)
129+
echo ""
130+
echo "✅ Version '${README_VERSION}' promoted to stable!"
44131
45-
- name: Set environment variable and run
46-
env:
47-
README_API_KEY: ${{ secrets.README_API_KEY }}
48-
run: python .github/scripts/sync-rpc-cmds.py

0 commit comments

Comments
 (0)