Skip to content

Commit 000b880

Browse files
author
abrulic
committed
workflow test
1 parent 29d481c commit 000b880

File tree

6 files changed

+365
-313
lines changed

6 files changed

+365
-313
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: 🤖 Branch Preview
2+
3+
concurrency:
4+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches: [main]
10+
11+
jobs:
12+
build-docs:
13+
name: Build Docs
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version-file: "package.json"
28+
cache: pnpm
29+
30+
- name: Install deps
31+
run: pnpm install --prefer-offline --frozen-lockfile
32+
33+
- name: Generate docs
34+
working-directory: docs
35+
env:
36+
APP_ENV: production
37+
run: pnpm run generate:docs
38+
39+
- name: Pack generated docs (tarball)
40+
run: |
41+
tar -czf docs-generated.tgz -C docs generated-docs
42+
ls -lh docs-generated.tgz
43+
- name: Upload generated docs (tgz)
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: docs-generated-tgz
47+
path: docs-generated.tgz
48+
if-no-files-found: error
49+
50+
- name: Upload versions file
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: docs-versions
54+
path: docs/app/utils/versions.ts
55+
if-no-files-found: error
56+
57+
deploy-docs-on-release:
58+
needs: [build-docs]
59+
name: Deploy Docs for Branch Preview
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Download generated docs (tgz)
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: docs-generated-tgz
68+
path: .
69+
70+
- name: Unpack generated docs into docs/
71+
run: |
72+
set -euxo pipefail
73+
tar -xzf docs-generated.tgz -C docs
74+
ls -laR docs/generated-docs | sed -n '1,200p'
75+
- name: Download versions file
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: docs-versions
79+
path: docs/app/utils
80+
81+
- uses: forge-42/fly-deploy@v1.0.0-rc.2
82+
id: deploy
83+
env:
84+
FLY_ORG: ${{ vars.FLY_ORG }}
85+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
86+
FLY_REGION: ${{ vars.FLY_REGION }}
87+
with:
88+
workspace_name: docs
89+
app_name: ${{github.event.repository.name}}-${{ github.ref_name }}
90+
use_isolated_workspace: true
91+
env_vars: |
92+
APP_ENV=production
93+
GITHUB_OWNER=${{ github.repository_owner }}
94+
GITHUB_REPO=${{ github.event.repository.name }}
95+
GITHUB_REPO_URL=https://github.com/${{ github.repository }}
Lines changed: 149 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,149 @@
1-
name: 🚀 Validation Pipeline
2-
concurrency:
3-
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
4-
cancel-in-progress: true
5-
on:
6-
push:
7-
branches: [main]
8-
pull_request:
9-
branches: [main]
10-
11-
permissions:
12-
actions: write
13-
contents: read
14-
# Required to put a comment into the pull-request
15-
pull-requests: write
16-
jobs:
17-
lint:
18-
name: ⬣ Biome lint
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: ⬇️ Checkout repo
22-
uses: actions/checkout@v4
23-
- name: Setup Biome
24-
uses: biomejs/setup-biome@v2
25-
- name: Run Biome
26-
run: biome ci .
27-
28-
validate:
29-
name: 🔎 Validate
30-
runs-on: ubuntu-latest
31-
steps:
32-
- name: 🛑 Cancel Previous Runs
33-
uses: styfle/cancel-workflow-action@0.12.1
34-
- name: ⬇️ Checkout repo
35-
uses: actions/checkout@v4
36-
- name: ⎔ Setup node
37-
uses: actions/setup-node@v4
38-
with:
39-
node-version-file: "package.json"
40-
- name: Install pnpm
41-
uses: pnpm/action-setup@v4
42-
- name: Install dependencies
43-
run: pnpm install
44-
- name: 🔎 Validate
45-
run: pnpm run test
46-
47-
build-docs:
48-
if: ${{ github.event_name == 'pull_request' }}
49-
name: Build Docs
50-
runs-on: ubuntu-latest
51-
steps:
52-
- name: Checkout
53-
uses: actions/checkout@v4
54-
with:
55-
# checkout the PR head branch
56-
ref: ${{ github.head_ref }}
57-
fetch-depth: 0
58-
59-
- name: Setup pnpm
60-
uses: pnpm/action-setup@v4
61-
62-
- name: Setup Node
63-
uses: actions/setup-node@v4
64-
with:
65-
node-version-file: "package.json"
66-
cache: pnpm
67-
68-
- name: Install deps
69-
run: pnpm install --prefer-offline --frozen-lockfile
70-
71-
- name: Generate docs
72-
working-directory: docs
73-
env:
74-
APP_ENV: production
75-
run: pnpm run generate:docs
76-
77-
- name: Pack generated docs (tarball)
78-
run: |
79-
tar -czf docs-generated.tgz -C docs generated-docs
80-
ls -lh docs-generated.tgz
81-
82-
- name: Upload generated docs (tgz)
83-
uses: actions/upload-artifact@v4
84-
with:
85-
name: docs-generated-tgz
86-
path: docs-generated.tgz
87-
if-no-files-found: error
88-
89-
- name: Upload versions file
90-
uses: actions/upload-artifact@v4
91-
with:
92-
name: docs-versions
93-
path: docs/app/utils/versions.ts
94-
if-no-files-found: error
95-
96-
deploy-docs-pr-preview:
97-
if: ${{ github.event_name == 'pull_request' }}
98-
needs: [lint, validate, build-docs]
99-
name: Deploy Docs PR Preview
100-
runs-on: ubuntu-latest
101-
steps:
102-
- uses: actions/checkout@v4
103-
104-
- name: Download generated docs (tgz)
105-
uses: actions/download-artifact@v4
106-
with:
107-
name: docs-generated-tgz
108-
path: .
109-
110-
- name: Unpack generated docs into docs/
111-
run: |
112-
set -euxo pipefail
113-
tar -xzf docs-generated.tgz -C docs
114-
ls -laR docs/generated-docs | sed -n '1,200p'
115-
116-
- name: Download versions file
117-
uses: actions/download-artifact@v4
118-
with:
119-
name: docs-versions
120-
path: docs/app/utils
121-
122-
- uses: forge-42/fly-deploy@v1.0.0-rc.2
123-
id: deploy
124-
env:
125-
FLY_ORG: ${{ vars.FLY_ORG }}
126-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
127-
FLY_REGION: ${{ vars.FLY_REGION }}
128-
with:
129-
workspace_name: docs
130-
app_name: react-router-devtools-docs-pr-${{ github.event.number }}
131-
use_isolated_workspace: true
132-
env_vars: |
133-
APP_ENV=production
134-
GITHUB_OWNER=${{ github.repository_owner }}
135-
GITHUB_REPO=${{ github.event.repository.name }}
136-
GITHUB_REPO_URL=https://github.com/${{ github.repository }}
1+
name: 🚀 Validation Pipeline
2+
concurrency:
3+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
4+
cancel-in-progress: true
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
permissions:
12+
actions: write
13+
contents: read
14+
# Required to put a comment into the pull-request
15+
pull-requests: write
16+
jobs:
17+
lint:
18+
name: ⬣ Biome lint
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: ⬇️ Checkout repo
22+
uses: actions/checkout@v4
23+
- name: Setup Biome
24+
uses: biomejs/setup-biome@v2
25+
- name: Run Biome
26+
run: biome ci .
27+
28+
validate:
29+
name: 🔎 Validate
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: 🛑 Cancel Previous Runs
33+
uses: styfle/cancel-workflow-action@0.12.1
34+
- name: ⬇️ Checkout repo
35+
uses: actions/checkout@v4
36+
- name: ⎔ Setup node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version-file: "package.json"
40+
- name: Install pnpm
41+
uses: pnpm/action-setup@v4
42+
- name: Install dependencies
43+
run: pnpm install
44+
- name: Install Playwright browsers
45+
# downloads browser binaries required by Playwright (Chromium/Firefox/WebKit)
46+
run: pnpm exec playwright install --with-deps
47+
- name: 🔎 Validate
48+
run: pnpm run test
49+
50+
build-docs:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
ref: ${{ github.head_ref }}
56+
fetch-depth: 0
57+
58+
- uses: pnpm/action-setup@v4
59+
- uses: actions/setup-node@v4
60+
with:
61+
node-version-file: "package.json"
62+
cache: pnpm
63+
64+
# One install at the workspace root is enough
65+
- name: Install deps (root)
66+
run: pnpm install --prefer-offline --frozen-lockfile
67+
68+
# Decide where the docs app lives: ./docs or .
69+
- name: Resolve DOCS_DIR
70+
id: paths
71+
shell: bash
72+
run: |
73+
if [ -d docs ] && [ -f docs/package.json ]; then
74+
DOCS_DIR="docs"
75+
else
76+
DOCS_DIR="."
77+
fi
78+
79+
# expose for later steps
80+
echo "DOCS_DIR=$DOCS_DIR" >> "$GITHUB_OUTPUT"
81+
82+
# ok to print within this step using the shell variable
83+
echo "Using DOCS_DIR=$DOCS_DIR"
84+
85+
- name: Generate docs
86+
env:
87+
APP_ENV: production
88+
run: pnpm -C "${{ steps.paths.outputs.DOCS_DIR }}" run generate:docs
89+
90+
- name: Pack generated docs (tarball)
91+
run: |
92+
OUT_BASE="${{ steps.paths.outputs.DOCS_DIR }}"
93+
tar -czf docs-generated.tgz -C "$OUT_BASE" generated-docs
94+
ls -lh docs-generated.tgz
95+
96+
- name: Upload generated docs (tgz)
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: docs-generated-tgz
100+
path: docs-generated.tgz
101+
if-no-files-found: error
102+
103+
- name: Upload versions file
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: docs-versions
107+
path: ${{ steps.paths.outputs.DOCS_DIR }}/app/utils/versions.ts
108+
if-no-files-found: error
109+
110+
deploy-docs-pr-preview:
111+
if: ${{ github.event_name == 'pull_request' }}
112+
needs: [lint, validate, build-docs]
113+
name: Deploy Docs PR Preview
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v4
117+
118+
- name: Download generated docs (tgz)
119+
uses: actions/download-artifact@v4
120+
with:
121+
name: docs-generated-tgz
122+
path: .
123+
124+
- name: Unpack generated docs into docs/
125+
run: |
126+
set -euxo pipefail
127+
tar -xzf docs-generated.tgz -C docs
128+
ls -laR docs/generated-docs | sed -n '1,200p'
129+
- name: Download versions file
130+
uses: actions/download-artifact@v4
131+
with:
132+
name: docs-versions
133+
path: docs/app/utils
134+
135+
- uses: forge-42/fly-deploy@v1.0.0-rc.2
136+
id: deploy
137+
env:
138+
FLY_ORG: ${{ vars.FLY_ORG }}
139+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
140+
FLY_REGION: ${{ vars.FLY_REGION }}
141+
with:
142+
workspace_name: docs
143+
app_name: react-router-devtools-docs-pr-${{ github.event.number }}
144+
use_isolated_workspace: true
145+
env_vars: |
146+
APP_ENV=production
147+
GITHUB_OWNER=${{ github.repository_owner }}
148+
GITHUB_REPO=${{ github.event.repository.name }}
149+
GITHUB_REPO_URL=https://github.com/${{ github.repository }}

0 commit comments

Comments
 (0)