Skip to content

Commit 206a108

Browse files
ci: seperate deploying flows
1 parent 0617fd2 commit 206a108

File tree

4 files changed

+86
-49
lines changed

4 files changed

+86
-49
lines changed

.github/workflows/deploy.yml renamed to .github/workflows/deploy-divar-dev.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy to Divar Dev
22

33
on:
44
push:
55
branches:
66
- master
77

88
jobs:
9-
build:
9+
build-divar-dev:
1010
name: Build Docusaurus
1111
runs-on: ubuntu-latest
1212
steps:
@@ -22,39 +22,19 @@ jobs:
2222
run: yarn install --frozen-lockfile
2323
- name: Build website
2424
run: yarn build
25+
env:
26+
PATH_PREFIX: "/"
27+
DEPLOY_PRIME_URL: "https://kenar.divar.dev"
2528

2629
- name: Upload Build Artifact
2730
uses: actions/upload-artifact@v4
2831
with:
2932
name: build-files
3033
path: build
3134

32-
- name: Upload Pages Artifact
33-
uses: actions/upload-pages-artifact@v3
34-
with:
35-
path: build
36-
37-
deploy-pages:
38-
name: Deploy to GitHub Pages
39-
needs: build
40-
41-
permissions:
42-
pages: write
43-
id-token: write
44-
45-
environment:
46-
name: github-pages
47-
url: ${{ steps.deployment.outputs.page_url }}
48-
49-
runs-on: ubuntu-latest
50-
steps:
51-
- name: Deploy to GitHub Pages
52-
id: deployment
53-
uses: actions/deploy-pages@v4
54-
5535
deploy-kise:
5636
name: Deploy to Kise(s3)
57-
needs: build
37+
needs: build-divar-dev
5838

5939
runs-on: ubuntu-latest
6040
steps:

.github/workflows/deploy-pages.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-pages:
10+
name: Build Docusaurus
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
cache: yarn
20+
21+
- name: Install dependencies
22+
run: yarn install --frozen-lockfile
23+
- name: Build website
24+
run: yarn build
25+
env:
26+
PATH_PREFIX: "/kenar-docs/"
27+
DEPLOY_PRIME_URL: "https://divar-ir.github.io"
28+
29+
- name: Upload Build Artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: build-files
33+
path: build
34+
35+
- name: Upload Pages Artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: build
39+
40+
deploy-pages:
41+
name: Deploy to GitHub Pages
42+
needs: build-pages
43+
44+
permissions:
45+
pages: write
46+
id-token: write
47+
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

docusaurus.config.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import type { Config } from '@docusaurus/types';
33
import type { ThemeConfig } from '@docusaurus/preset-classic';
44
import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
55

6-
const isNetlifyPreview = process.env.IS_NETLIFY === 'true';
6+
const pathPrefix = process.env.PATH_PREFIX ? process.env.PATH_PREFIX : '/kenar-docs/';
7+
const url = process.env.DEPLOY_PRIME_URL ? process.env.DEPLOY_PRIME_URL : 'https://divar-ir.github.io';
78

89
const config: Config = {
910
title: 'مستندات کنار دیوار',
1011
tagline: 'مستندات فنی پلتفرم کنار دیوار - راهنمای توسعه‌دهندگان',
1112
favicon: 'img/favicon.ico',
1213

13-
url: (isNetlifyPreview && process.env.DEPLOY_PRIME_URL) ? process.env.DEPLOY_PRIME_URL : 'https://divar-ir.github.io',
14-
baseUrl: isNetlifyPreview ? '/' : '/kenar-docs',
14+
baseUrl: pathPrefix,
15+
url: url,
1516

1617
organizationName: 'divar-ir',
1718
projectName: 'kenar-docs',
@@ -156,7 +157,7 @@ const config: Config = {
156157
groupPathsBy: "tag",
157158
categoryLinkSource: "tag"
158159
},
159-
baseUrl: "/openapi-doc/",
160+
baseUrl: "/openapi-doc/",
160161
downloadUrl:
161162
"https://raw.githubusercontent.com/divar-ir/kenar-docs/main/static/openapi-v3.yaml",
162163
showSchemas: true,
@@ -283,24 +284,24 @@ const config: Config = {
283284
theme: prismThemes.github,
284285
darkTheme: prismThemes.dracula,
285286
additionalLanguages: [
286-
'csharp',
287-
'http',
288-
'dart',
289-
'go',
290-
'http',
291-
'java',
292-
'javascript',
293-
'kotlin',
294-
'c',
295-
'objectivec',
296-
'ocaml',
297-
'php',
298-
'powershell',
299-
'python',
300-
'r',
301-
'ruby',
302-
'rust',
303-
'swift',
287+
'csharp',
288+
'http',
289+
'dart',
290+
'go',
291+
'http',
292+
'java',
293+
'javascript',
294+
'kotlin',
295+
'c',
296+
'objectivec',
297+
'ocaml',
298+
'php',
299+
'powershell',
300+
'python',
301+
'r',
302+
'ruby',
303+
'rust',
304+
'swift',
304305
],
305306
},
306307
// Enhanced metadata for better SEO

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
[build.environment]
66
NODE_VERSION = "22"
7-
IS_NETLIFY = "true"
7+
PATH_PREFIX = "/"
88

0 commit comments

Comments
 (0)