Skip to content

Commit f7e4a97

Browse files
authored
ci: publish docs on tag push (#336)
closes #290
1 parent b220658 commit f7e4a97

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ jobs:
5959

6060
- name: Check for uncommitted changes
6161
run: ./scripts/assert-clean-working-directory.sh
62-
63-
- name: Publish documentation
64-
if: github.ref == 'refs/heads/main'
65-
run: |
66-
git config user.name "github-actions[bot]"
67-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
68-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
69-
yarn lerna run publish:gh-pages --scope '@nahkies/openapi-code-generator-documentation'
70-
7162
# TODO: figure out how to do this safely, eg: no risk of external contributors exfiltrating publish secret.
7263
# - name: Configure Git User
7364
# run: |

.github/workflows/publish-docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Docs
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
jobs:
8+
publish_docs:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [24.x]
13+
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
21+
with:
22+
registry-url: "https://registry.npmjs.org"
23+
node-version: ${{ matrix.node-version }}
24+
25+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
26+
id: yarn-cache
27+
with:
28+
path: .yarn
29+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-yarn-
32+
33+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
34+
id: nextjs-cache
35+
with:
36+
path: packages/documentation/.next/cache
37+
key: ${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
38+
restore-keys: |
39+
${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-
40+
41+
- run: corepack enable
42+
43+
- run: yarn --immutable
44+
- run: yarn ci-build
45+
- name: Publish documentation
46+
if: github.ref == 'refs/heads/main'
47+
run: |
48+
git config user.name "github-actions[bot]"
49+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
50+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
51+
yarn lerna run publish:gh-pages --scope '@nahkies/openapi-code-generator-documentation'

0 commit comments

Comments
 (0)