-
Notifications
You must be signed in to change notification settings - Fork 459
56 lines (54 loc) · 1.87 KB
/
deploy.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
name: Entry Build and Deploy
on:
push:
branches:
- 'deploy/**'
- master
- develop-hw
- develop2
- develop
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
env:
NODE_OPTIONS: '--max-old-space-size=4096'
TOOL_NODE_FLAGS: '--max-old-space-size=4096'
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: true
- name: entry build
env:
NODE_OPTIONS: '--max-old-space-size=4096'
TOOL_NODE_FLAGS: '--max-old-space-size=4096'
run: pnpm run prod
- name: Define branch name
id: target_branch
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
- uses: haya14busa/action-cond@v1
id: deploy_branch
with:
cond: ${{ steps.target_branch.outputs.branch == 'master' }}
if_true: 'build'
if_false: dist/${{ steps.target_branch.outputs.branch }}
- name: Execute build.sh
run: |
sh ./scripts/build.sh
- name: Execute deploy.sh
run: |
sh ./scripts/deploy.sh
- name: Push Changes into build branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
directory: ./build
branch: ${{ steps.deploy_branch.outputs.value }}