Skip to content

Commit 19ac475

Browse files
committed
update deploy scripts
1 parent 909208b commit 19ac475

File tree

4 files changed

+102
-46
lines changed

4 files changed

+102
-46
lines changed

.github/workflows/deploy.yaml

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,53 @@
1-
name: Deploy specification
1+
name: Deploy to GitHub Pages
22

33
on:
44
push:
55
branches:
66
- main
7+
# Review gh actions docs if you want to further define triggers, paths, etc
8+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
79

810
env:
9-
# this avoids node running out of memory while building
10-
NODE_OPTIONS: --max_old_space_size=20480
11-
11+
cwd: ${{github.workspace}}/site
1212
jobs:
13-
deploy-spec:
13+
build:
14+
name: Build Docusaurus
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v2
17-
- name: Use Node.js 15
18-
uses: actions/setup-node@v1
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: npm
24+
25+
- name: Install dependencies
26+
run: npm install --frozen-lockfile
27+
- name: Build website
28+
run: npm run build
29+
30+
- name: Upload Build Artifact
31+
uses: actions/upload-pages-artifact@v3
1932
with:
20-
node-version: '15'
21-
- run: npm ci
22-
- run: npm run build
23-
- name: setup git config
24-
run: |
25-
git config user.name "GitHub Actions Bot"
26-
git config user.email "<>"
27-
- name: Deploy assembled spec
28-
run: |
29-
git checkout -b assembled-spec
30-
git add -f openrpc.json
31-
git add -f refs-openrpc.json
32-
git commit -m "assemble openrpc.json"
33-
git push -fu origin assembled-spec
34-
deploy-gh-pages:
33+
path: build
34+
35+
deploy:
36+
name: Deploy to GitHub Pages
37+
needs: build
38+
39+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
40+
permissions:
41+
pages: write # to deploy to Pages
42+
id-token: write # to verify the deployment originates from an appropriate source
43+
44+
# Deploy to the github-pages environment
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
3549
runs-on: ubuntu-latest
3650
steps:
37-
- uses: actions/checkout@v2
38-
- name: Use Node.js 15
39-
uses: actions/setup-node@v1
40-
with:
41-
node-version: '15'
42-
- run: npm ci
43-
- run: npm run build
44-
- run: npm run generate-clients
45-
- run: 'sed -i -e "s|Prefix: \"\"|Prefix: \"/execution-apis\"|g" build/docs/gatsby/gatsby-config.js'
46-
- run: 'sed -i -e "s|/api|api|g" build/docs/gatsby/src/pages/index.tsx'
47-
- run: npm run build:docs
48-
- name: setup git config
49-
run: |
50-
git config user.name "GitHub Actions Bot"
51-
git config user.email "<>"
5251
- name: Deploy to GitHub Pages
53-
if: success()
54-
uses: crazy-max/ghaction-github-pages@v3
55-
with:
56-
target_branch: gh-pages
57-
build_dir: build/docs/gatsby/public
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.github/workflows/deploy.yaml.old

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy specification
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
# this avoids node running out of memory while building
10+
NODE_OPTIONS: --max_old_space_size=20480
11+
12+
jobs:
13+
deploy-spec:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js 15
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: '15'
21+
- run: npm ci
22+
- run: npm run build
23+
- name: setup git config
24+
run: |
25+
git config user.name "GitHub Actions Bot"
26+
git config user.email "<>"
27+
- name: Deploy assembled spec
28+
run: |
29+
git checkout -b assembled-spec
30+
git add -f openrpc.json
31+
git add -f refs-openrpc.json
32+
git commit -m "assemble openrpc.json"
33+
git push -fu origin assembled-spec
34+
deploy-gh-pages:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Use Node.js 15
39+
uses: actions/setup-node@v1
40+
with:
41+
node-version: '15'
42+
- run: npm ci
43+
- run: npm run build
44+
- run: npm run generate-clients
45+
- run: 'sed -i -e "s|Prefix: \"\"|Prefix: \"/execution-apis\"|g" build/docs/gatsby/gatsby-config.js'
46+
- run: 'sed -i -e "s|/api|api|g" build/docs/gatsby/src/pages/index.tsx'
47+
- run: npm run build:docs
48+
- name: setup git config
49+
run: |
50+
git config user.name "GitHub Actions Bot"
51+
git config user.email "<>"
52+
- name: Deploy to GitHub Pages
53+
if: success()
54+
uses: crazy-max/ghaction-github-pages@v3
55+
with:
56+
target_branch: gh-pages
57+
build_dir: build/docs/gatsby/public
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

site/.nojekyll

Whitespace-only changes.

site/docusaurus.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ const config: Config = {
1717

1818
// GitHub pages deployment config.
1919
// If you aren't using GitHub pages, you don't need these.
20-
organizationName: 'ethereum', // Usually your GitHub org/user name.
20+
organizationName: 'acolytec3', // Usually your GitHub org/user name.
2121
projectName: 'execution-apis', // Usually your repo name.
22+
deploymentBranch: 'gh-pages',
2223

2324
onBrokenLinks: 'throw',
2425
onBrokenMarkdownLinks: 'warn',
@@ -37,12 +38,14 @@ const config: Config = {
3738
/** @type {import('@metamask/docusaurus-openrpc/dist/preset').Options} */
3839
{
3940
docs: {
41+
id: 'execution-apis',
4042
routeBasePath: '/',
4143
openrpc: {
4244
openrpcDocument: '../refs-openrpc.json',
4345
path: 'Reference',
4446
sidebarLabel: 'JSON-RPC',
4547
},
48+
path: '/',
4649
sidebarPath: './sidebars.ts',
4750
// Please change this to your repo.
4851
// Remove this to remove the "edit this page" links.

0 commit comments

Comments
 (0)