diff --git a/.github/workflows/generate-documentation.yml b/.github/workflows/generate-documentation.yml new file mode 100644 index 0000000000..edf760884d --- /dev/null +++ b/.github/workflows/generate-documentation.yml @@ -0,0 +1,77 @@ +name: Generate Documentation + +on: + workflow_call: + inputs: + git_ref: + description: 'Git ref to checkout (branch, tag, or commit SHA)' + required: true + type: string + +env: + GIT_REF: ${{ inputs.git_ref }} + +jobs: + generate-documentation: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x] + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ env.GIT_REF }} + fetch-depth: 0 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup npm version 10 + run: | + npm i -g npm@10 --registry=https://registry.npmjs.org + - name: Cache node modules + id: cache-nodemodules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + # caching node_modules + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-deps-${{ matrix.node-version }}- + - name: Install Dependencies + if: steps.cache-nodemodules.outputs.cache-hit != 'true' + run: npm ci + + - run: npm run build + + - name: Generate Documentation + run: npm run docgen + + - name: Upload documentation files as artifact + id: docs-artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/ + retention-days: 10 + + deploy-docs-pages: + permissions: + id-token: write # Needed for OIDC authentication + pages: write # this permission is needed for deploying into Github Pages + environment: + name: github-pages + url: ${{ steps.docs-artifact.outputs.page_url }} + runs-on: ubuntu-latest + needs: generate-documentation + steps: + - name: Deploy to Documentation to GitHub Pages + id: docs-artifact + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 62f8660527..569644abab 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -214,79 +214,3 @@ jobs: - name: Stop docker container if: always() run: docker stop rippled-service - - generate-documentation: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [24.x] - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ env.GIT_REF }} - fetch-depth: 0 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Setup npm version 10 - run: | - npm i -g npm@10 --registry=https://registry.npmjs.org - - - name: Cache node modules - id: cache-nodemodules - uses: actions/cache@v4 - env: - cache-name: cache-node-modules - with: - # caching node_modules - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-deps-${{ matrix.node-version }}- - - - name: Install Dependencies - if: steps.cache-nodemodules.outputs.cache-hit != 'true' - run: npm ci - - - run: npm run build - - - name: Generate Documentation - run: npm run docgen - - - name: Upload documentation files as artifact - id: docs-artifact - uses: actions/upload-pages-artifact@v3 - with: - path: docs/ - retention-days: 10 - - deploy-docs-pages: - permissions: - id-token: write # Needed for OIDC authentication - pages: write # this permission is needed for deploying into Github Pages - environment: - name: github-pages - url: ${{ steps.docs-artifact.outputs.page_url }} - runs-on: ubuntu-latest - needs: generate-documentation - # Deploy docs only pushes into the main branch - if: success() && github.ref == 'refs/heads/main' - steps: - - name: Detect (non-beta) version tag - id: check-tag - run: | - if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "published_version_tag=true" >> $GITHUB_OUTPUT - fi - - - name: Deploy to Documentation to GitHub Pages - id: docs-artifact - if: steps.check-tag.outputs.published_version_tag == 'true' - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ddd20c838d..4a1630f846 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -632,3 +632,15 @@ jobs: --arg channel "#xrpl-js" \ --arg text "$MESSAGE" \ '{channel: $channel, text: $text}')" + + generate-documentation: + name: Generate and Publish documentation for ${{ needs.get_version.outputs.package_version }} + if: ${{ github.event.inputs.npmjs_dist_tag == 'latest' }} + uses: ./.github/workflows/generate-documentation.yml + needs: [get_version, release] + with: + git_ref: ${{ github.ref_name }} + permissions: + contents: read + id-token: write + pages: write diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6bda0fb2b2..541d956f6b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -241,7 +241,6 @@ Note: The same updated config can be used to update xrpl-py's CI as well. - [ ] Update the version number and release date, and ensure it lists the changes since the previous release. -4. Run `npm run docgen` if the docs were modified in this release to update them (skip this step for a beta). 5. Run `npm run clean` to delete previously generated artifacts. 6. Run `npm run build` to triple check the build still works 7. Run `npx lerna version --no-git-tag-version` - This bumps the package versions. @@ -265,6 +264,7 @@ Note: The same updated config can be used to update xrpl-py's CI as well. 13. Run `git tag -m `, where `` is the new package and version (e.g. `xrpl@2.1.1`), for each version released. 14. Run `git push --follow-tags`, to push the tags to Github. + 15. On GitHub, click the "Releases" link on the right-hand side of the page. 16. Repeat for each release: