forked from celetor/web-yuedu3
-
Notifications
You must be signed in to change notification settings - Fork 67
67 lines (56 loc) · 1.9 KB
/
build.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
60
61
62
63
64
65
66
67
name: Build
on:
#push:
# branches:
# - master
#workflow_dispatch:
env:
UPSTREAM_REPOSITORY: gedoor/legado_web_bookshelf
jobs:
master:
runs-on: ubuntu-latest
steps:
- name: Checkout legado_web_bookshelf Project
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Project
run: |
npm install
- name: Format code
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
run: |
npm run-script lint
- name: push changes
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
uses: stefanzweifel/[email protected]
with:
commit_message: 'style: format code'
file_pattern: src
- name: Build
run: |
export NODE_OPTIONS=--openssl-legacy-provider
npm run-script build
- name: Set Env
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
shell: bash
run: |
version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
echo "APP_VER=$version" >> $GITHUB_ENV
- name: Push changes to legado
continue-on-error: true
if: ${{ github.repository == env.UPSTREAM_REPOSITORY }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git clone "https://gedoor:${{ secrets.ACTIONS_TOKEN }}@github.com/gedoor/legado" --depth 1
rm -rf legado/app/src/main/assets/web/bookshelf/*
mv -f $GITHUB_WORKSPACE/dist/* legado/app/src/main/assets/web/bookshelf/
cd legado
git add -A
git commit -m "web bookshelf: ${{ env.APP_VER }}"
git push