-
Notifications
You must be signed in to change notification settings - Fork 37
59 lines (55 loc) · 1.8 KB
/
ci.yml
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
name: Build
# Avoid triggering two build on PR
# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: macos-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/setup-node@v2
with:
node-version: '14'
- uses: pnpm/[email protected]
with:
version: 6.32
- name: Install and Build 🔧
run: |
pnpm i
MESSAGE=$(git log -1 HEAD --pretty=format:%s)
if [[ "$MESSAGE" == *fgen* ]]; then
pnpm generate
else
git diff --name-only HEAD~1 HEAD | grep src/data.ts && pnpm generate
fi
pnpm build:vite
- name: Commit files
run: |
git config --local user.name github-actions[bot]
git config --local user.email github-actions[bot]@users.noreply.github.com
git status
git add .
git diff-index --quiet HEAD || git commit -m "Generate README.md using src/data.ts"
git log
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: false
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: dist # The folder the action should deploy.
git-config-name: 'github-actions[bot]'
git-config-email: 'github-actions[bot]@users.noreply.github.com'