Repository navigation
113 lines (85 loc) · 2.84 KB
/
Copy pathstaging-docs.yml
File metadata and controls
113 lines (85 loc) · 2.84 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
name: Staging Docs
on:
push:
branches:
- 'dev'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'element-plus' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Setup node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Get version
run: echo "TAG_VERSION=0.0.0-staging.${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Get git head
run: echo "GIT_HEAD=${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set last version
run: pnpm update:version && pnpm gen:version
env:
TAG_VERSION: ${{env.TAG_VERSION}}
GIT_HEAD: ${{env.GIT_HEAD}}
- name: Compile Element Plus
run: pnpm build
env:
NODE_OPTIONS: --max-old-space-size=4096
- name: Init Crowdin token
run: pnpm run docs:crowdin-credentials
env:
CROWDIN_TOKEN: ${{secrets.CROWDIN_TOKEN}}
- name: Upload source files
run: cd docs && pnpm exec crowdin upload sources
- name: Pull Crowdin translations
run: cd docs && pnpm exec crowdin download -l zh-CN && pnpm exec crowdin download -l es-ES
- name: Generate common locale
run: pnpm docs:gen-locale
- name: Build Metadata
run: cd internal/metadata && pnpm build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build website
run: pnpm docs:build
env:
DOC_ENV: staging
NODE_OPTIONS: --max-old-space-size=8192
- name: Deploy staging website
run: |
set -euo pipefail
REPO_DIR="$(mktemp -d)"
git clone \
--depth=1 \
https://x-access-token:${{ secrets.EP_BOT_TOKEN }}@github.com/element-plus/staging.git \
"$REPO_DIR"
rsync -a \
--delete \
--exclude .git \
--exclude CNAME \
docs/.vitepress/dist/ \
"$REPO_DIR/"
cd "$REPO_DIR"
git config user.name "ElementPlusBot"
git config user.email "element-plus@outlook.com"
git add -A
if git diff --cached --quiet; then
echo "No changes"
exit 0
fi
git commit -m "website deploy ${TAG_VERSION}"
git push origin main --force-with-lease