diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 5be77d449..a0dcf4f98 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,6 +20,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: actions/setup-go@v6 with: @@ -38,6 +40,17 @@ jobs: - name: Install JS dependencies run: npm ci + - name: Create versioned doc snapshots + run: | + VERSIONS=$(node -e "console.log(require('./api_versions.json').join('\n'))") + if [ -n "$VERSIONS" ]; then + for VERSION in $VERSIONS; do + git checkout "refs/tags/$VERSION" -- docs-api/ + npm run docs:version -- "$VERSION" + done + git checkout HEAD -- docs-api/ + fi + - name: Build docs run: npm run build:docs diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..1cf233b85 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,28 @@ +name: Release + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + attach-openrpc-spec: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v6 + with: + go-version: ^1.26 + id: go + + - name: Build the spec + run: make build + + - name: Upload OpenRPC spec to release + run: | + gh release upload ${{ github.event.release.tag_name }} openrpc.json refs-openrpc.json + env: + GH_TOKEN: ${{ github.token }} diff --git a/api_versions.json b/api_versions.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/api_versions.json @@ -0,0 +1 @@ +[] diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 42a08798a..dcda76f34 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -38,6 +38,13 @@ const config: Config = { path: 'docs-api', routeBasePath: '/', sidebarPath: './docs-api/sidebars.ts', + lastVersion: 'current', + versions: { + current: { + label: 'Next', + badge: false, + }, + }, }], ['@docusaurus/plugin-client-redirects', { redirects: [{ from: '/api', to: '/' }], @@ -74,6 +81,7 @@ const config: Config = { title: 'Execution APIs', items: [ { type: 'docSidebar', sidebarId: 'docsSidebar', docsPluginId: 'api', label: 'Docs', position: 'left' }, + { type: 'docsVersionDropdown', docsPluginId: 'api', position: 'right' }, { href: 'https://github.com/ethereum/execution-apis', label: 'GitHub', position: 'right' }, ], }, diff --git a/package.json b/package.json index ca7128cbe..81603dc0c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "serve": "docusaurus serve", "clear": "docusaurus clear", "watch": "nodemon --watch src --watch docs-api/docs --watch README.md --ignore docs-api/docs/quickstart.md --ext yaml,md,json --exec \"npm run build:spec && npm run docs:copy\"", - "docs:copy": "cp README.md ./docs-api/docs/quickstart.md" + "docs:copy": "cp README.md ./docs-api/docs/quickstart.md", + "docs:version": "docusaurus docs:version:api" }, "repository": { "type": "git",