Skip to content

Commit 64dc607

Browse files
Add GitHub Actions & Documentation about auto updating docs
1 parent 6092fb6 commit 64dc607

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.github/workflows/update-docs.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Update Documentation
2+
3+
on:
4+
issues:
5+
types: [ labeled ]
6+
7+
jobs:
8+
update_docs:
9+
if: contains(github.event.issue.labels.*.name, 'update-docs')
10+
runs-on: ubuntu
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout Latest Code
17+
uses: actions/checkout@v3
18+
19+
- name: Install NodeJS
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- name: Install Dependencies
25+
run: npm install
26+
27+
- name: Setup Submodules
28+
run: git submodule init
29+
30+
- name: Install Submodules
31+
run: git submodule update
32+
33+
- name: Update Submodules
34+
run: git submodule update --remote --merge
35+
36+
- name: Update Latest Pulsar Version
37+
run: node ./pulsar-api/update-latest-script.js ${{ github.event.issue.title }}
38+
39+
- name: Update Documentation
40+
run: npm run generate:docs
41+
42+
- name: Create Pull Request with Changes
43+
uses: peter-evans/create-pull-request@v4
44+
with:
45+
# If we ever start running tests on PRs we will need to provide a custom
46+
# PAT token here to ensure additional workflows are allowed to run.
47+
# https://github.com/pulsar-edit/pulsar-chocolatey/blob/main/.github/workflows/draft_publish.yml
48+
# token: ${{ secrets.<TOKEN_NAME_TO_ADD> }}
49+
commit-message: Auto update source code documentation
50+
branch: docs-update-${{ github.event.issue.title }}
51+
delete-branch: true
52+
title: '[${{ github.event.issue.title }}] Documentation Update'
53+
body: |
54+
Automated update of Source Code documentation.
55+
Will close #${{ github.event.issue.number }}
56+
draft: false

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,20 @@ But for all other links, please do follow this rule and do not use relative link
8484
Examples: When linking to `/example/sub/page` from `/example/sub/hello`
8585
- Do: `/example/sub/page`
8686
- Do **NOT**: `../page`
87+
88+
## Update Source Code Documentation
89+
90+
### Auto
91+
92+
Create an issue against this repository, with the title formatted strictly as the new Pulsar version number.
93+
Such as `1.124.0`
94+
95+
Then once the issue is created, afterwards add the label `update-docs`
96+
97+
After a short time a PR will be created against the repository with the changes to go ahead and review.
98+
99+
### Manual
100+
101+
1) Update the JSON file `./pulsar-api/latest.json` with the newest Pulsar version.
102+
2) Update all submodules to their latest commit, such as `git submodule update --remote --merge`
103+
3) Run `npm run generate:docs` to trigger the documentation to be updated.

pulsar-api/update-latest-script.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Updates the version in `latest.json` to the one provided when running this file
2+
const fs = require("fs");
3+
const path = require("path");
4+
5+
const newVer = process.argv.slice(2)[0]; // take first argument
6+
const verFile = JSON.parse(fs.readFileSync(path.join(__dirname, "./latest.json"), { encoding: "utf8" }));
7+
8+
verFile.latest = newVer;
9+
10+
fs.writeFileSync(path.join(__dirname, "./latest.json"), JSON.stringify(verFile, null, 2), { encoding: "utf8" });

0 commit comments

Comments
 (0)