|
13 | 13 | - 'doc/*.8.md' |
14 | 14 | - 'doc/lightningd-*.7.md' |
15 | 15 | - '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]+' |
16 | 20 | workflow_dispatch: |
17 | 21 |
|
18 | 22 | 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 |
19 | 53 | 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 |
21 | 57 | 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 |
24 | 69 |
|
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 |
29 | 72 |
|
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 |
33 | 116 |
|
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..." |
36 | 121 |
|
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 | + }' |
39 | 128 |
|
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!" |
44 | 131 |
|
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