-
Notifications
You must be signed in to change notification settings - Fork 9
114 lines (98 loc) · 2.72 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
114 lines (98 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Deploy Ocean Documentation
on:
push:
branches:
- master
- main
paths:
- 'packages/ocean-docs/**'
- 'packages/ocean-react/**'
- 'packages/ocean-core/**'
- '.github/workflows/deploy-docs.yml'
- 'package.json'
pull_request:
branches:
- master
- main
paths:
- 'packages/ocean-docs/**'
- 'packages/ocean-react/**'
concurrency:
group: deploy-${{ github.ref_name }}
cancel-in-progress: false
jobs:
build-and-deploy:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
# Build todos os pacotes
- name: Build all packages
run: |
yarn build:libs
yarn build:storybook
yarn build:docs
# Prepara o diretório de deploy
- name: Prepare deployment directory
run: |
# Cria diretório temporário para o deploy
mkdir -p ./deploy-temp
# Move o Storybook para a raiz
cp -r storybook-static/* ./deploy-temp/
# Move o Docusaurus para /docs
mkdir -p ./deploy-temp/docs
cp -r packages/ocean-docs/build/* ./deploy-temp/docs/
# Deploy único para GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./deploy-temp
force_orphan: true
test-build:
name: Test Build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build all packages
run: |
yarn build:libs
yarn build:storybook
yarn build:docs
- name: Test serve documentation
run: |
cd packages/ocean-docs
yarn serve &
sleep 10
curl -f http://localhost:3000/ || exit 1
- name: Test serve Storybook
run: |
yarn serve:storybook &
sleep 10
curl -f http://localhost:6006/ || exit 1