-
Notifications
You must be signed in to change notification settings - Fork 71
43 lines (42 loc) · 1.42 KB
/
lint_format_and_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
name: Lint, format and build
on:
push:
branches:
- master
jobs:
lint-format-build:
name: Lint, format and build
runs-on:
- ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.ACTIONS_PAT }}
- name: install npm dependencies
run: npm i
- name: lint, format, build and push automatic fixes
run: |
COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }})
if [[ $COMMIT_MESSAGE == *"[ci commit]"* ]]; then
echo "Commit message contains [ci commit], exiting workflow."
exit 0
fi
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
shopt -s globstar
npm run lint || echo -n
npx prettier --config .prettierrc --ignore-path .prettierignore -w *.ts src/**/*.ts
git add *.ts src
git commit -m '[ci commit] Lint and format code' || echo -n
git push
npm run build
git add dist --force
git commit -m '[ci commit] Automatic build' || echo -n
git push
bash grpc_gen_types.sh
npm run build
git add src/grpc/types src/grpc/proto.ts dist --force
git commit -m '[ci commit] Update proto files and types' || echo -n
git push