-
-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (88 loc) · 2.53 KB
/
Build.yml
File metadata and controls
98 lines (88 loc) · 2.53 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
name: Build
on:
push:
branches:
- main
paths:
- "packages/**"
# - 'dist/**'
- "site-astro/**"
jobs:
def:
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v5
# Get Post Changes
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v46
with:
files_yaml: |
packages:
- 'packages/**'
# List all changed files
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.packages_all_changed_files }}; do
echo "$file was changed"
done
# Setup Node
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
# Install pnpm && Build Packages
- name: Install pnpm && Build Packages
if: steps.changed-files.outputs.packages_any_changed == 'true'
run: |
npm install -g pnpm
pnpm install
# pnpm -r install
pnpm -r run lint
pnpm -r run build
# Setup Python
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pipenv
# Install pipenv and dependencies
- name: Install pipenv and dependencies
run: |
pip3 install --user pipenv
pipenv --python python3 && pipenv install
# Pipenv Build
- name: Pipenv Build
env:
GIT_CHANGED_FILES: ${{ steps.changed-files.outputs.packages_all_changed_files }}
run: |
pipenv run build
# Install Deps && Build Astro
- name: Install Deps && Build Astro
run: |
cd site-astro
npm install
npm run build
# 写入 .nojekyll 到 docs 目录
cd .. && touch docs/.nojekyll
# Commit Changes To Git
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git status
# git diff-index --quiet HEAD || (git commit -m "Auto Commit" -a --no-verify)
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Auto Commit" -a --no-verify
fi
# Push Changes To Git
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}