-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (104 loc) · 3.22 KB
/
cd.yaml
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CD
on:
push:
branches: ["main"]
env:
NODE_VERSION: "18.13"
jobs:
test:
if: "!contains(github.event.head_commit.message, 'ver: ')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: true
- name: Test eslint
run: pnpm test:eslint
- name: Test prettier
run: pnpm test:prettier
update:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Regist author
run: git config --global user.email "[email protected]" && git config --global user.name "HyeokjaeLee"
- name: Pull branch
run: git pull
- name: Set new patch version
if: "!contains(github.event.head_commit.message, '+m')"
run: "pnpm version patch && pnpm run patch"
- name: Set new minor version
if: "contains(github.event.head_commit.message, '+minor')"
run: "pnpm version minor && pnpm run minor"
- name: Set new major version
if: "contains(github.event.head_commit.message, '+major')"
run: "pnpm version major && pnpm run major"
- name: Get version
id: get-version
uses: beaconbrigade/[email protected]
with:
path: .
- name: Commit new version
run: "git reset HEAD^ && git add -A && git commit -m 'ver: ${{ steps.get-version.outputs.version }}' && git push"
tag:
needs: update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Pull branch
run: git pull
- name: Get version
id: get-version
uses: beaconbrigade/[email protected]
with:
path: .
- name: Create release & tag
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
release_name: ${{ steps.get-version.outputs.version }}
deploy:
needs: update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
- name: Pull branch
run: git pull
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: true
- name: Deploy
run: pnpm run deploy
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}