Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions .circleci/config.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
push:
branches-ignore: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun test
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy docs to GitHub Pages

on:
push:
branches: [master]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "24"
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: docs

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- id: deploy
uses: actions/deploy-pages@v4
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release

on:
workflow_dispatch:

jobs:
prepare-release:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@github.com"
- name: Install Knope
uses: knope-dev/action@v2.1.2
with:
version: 0.22.3
- run: knope prepare-release --verbose
name: Update versioned files and changelog
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Store commit SHA
id: commit
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

release:
needs: prepare-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-release.outputs.sha }}
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Install Knope
uses: knope-dev/action@v2.1.2
with:
version: 0.22.3
- run: knope release --verbose
name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build:bundle
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.DS_Store
build/
dist/
docs/
node_modules/
generated/
.vscode/
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.13.0
24.11.0
45 changes: 0 additions & 45 deletions .releaserc

This file was deleted.

45 changes: 38 additions & 7 deletions bin/build.ghpages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,36 @@ const filterAsset = (asset) => {
return asset.name.indexOf('.md') >= 0;
}

const compareSemver = (v1, v2) => {
// Split into [core, pre] -> ["1.2.0", "rc1"]
const [core1, pre1] = v1.split('-');
const [core2, pre2] = v2.split('-');

const n1 = core1.split('.').map(Number);
const n2 = core2.split('.').map(Number);

// 1. Compare Core Version Numerically
for (let i = 0; i < 3; i++) {
if (n1[i] > n2[i]) return 1;
if (n1[i] < n2[i]) return -1;
}

// 2. If core versions are identical, check pre-release tags
// A version with NO tag is GREATER than a version with a tag (e.g., 1.0.0 > 1.0.0-rc1)
if (pre1 && !pre2) return -1;
if (!pre1 && pre2) return 1;
if (!pre1 && !pre2) return 0;

// 3. Compare "rc0" vs "rc1" (Lexicographical works here because lengths are same)
if (pre1 > pre2) return 1;
if (pre1 < pre2) return -1;

return 0;
}


const build = async () => {
const buildDir = "./build/ghpages";
const buildDir = "./docs";

await fsx.ensureDir(buildDir);
await fsx.emptyDir(buildDir);
Expand All @@ -31,32 +59,35 @@ const build = async () => {
const previousVersions = await readdir(buildDir);

await Promise.all(previousVersions.map(async (version) => {
if (compareSemver(version,"1.4.0") <= 0){
const dirName = `${buildDir}/${version}`;
const [filename] = await readdir(dirName);
await fsx.move(`${dirName}/${filename}`, `${dirName}/index.md`);
}
}));



await buildMarkdown();
const markdownBuildFilename = "./build/markdown/spec.md";
let latestVersionFolderName = `${buildDir}/${specVersion}`;
// let latestVersionFolderName = `${buildDir}/${specVersion}`;

await mkdir(`${buildDir}/latest`);
// NOTE: No longer building latest version folder
// await mkdir(`${buildDir}/latest`);
try {
await mkdir(latestVersionFolderName);
} catch (e) {
console.log(`latest version already exists as a release on github: ${latestVersionFolderName}`);
latestVersionFolderName = `${buildDir}/development`;
await mkdir(latestVersionFolderName);
}
await copyFile(markdownBuildFilename, `${buildDir}/index.md`);
await copyFile(markdownBuildFilename, `${buildDir}/latest/index.md`);
await copyFile("./build/markdown/spec.md", `${latestVersionFolderName}/spec.md`);
// await copyFile(markdownBuildFilename, `${buildDir}/index.md`);
// await copyFile(markdownBuildFilename, `${buildDir}/latest/index.md`);
// await copyFile("./build/markdown/spec.md", `${latestVersionFolderName}/spec.md`);

await writeFile(`${buildDir}/CNAME`, "spec.open-rpc.org");

console.log("building ghpages complete. gh-pages build ready to release!");
console.log("building docs complete. docs/ ready to deploy!");
};

if (require.main === module) {
Expand Down
2 changes: 1 addition & 1 deletion bin/build.markdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const build = async () => {
const buildDir = "./build/markdown/";
await fsx.ensureDir(buildDir);
await fsx.emptyDir(buildDir);
const specContent = await readFile("./spec.md", "utf8");
const specContent = await readFile("./spec/legacy/spec.md", "utf8");
const withToc = toc.insert(specContent);
const withVersion = replaceVersionComments(withToc);
await writeFile(`${buildDir}/spec.md`, withVersion);
Expand Down
Loading