-
Notifications
You must be signed in to change notification settings - Fork 14
180 lines (151 loc) · 4.33 KB
/
release.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Release
on:
release:
types: [published]
jobs:
finalize_release:
name: Finalize Release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
ref: "master"
token: ${{secrets.SERVICE_PERSONAL_ACCESS_TOKEN}}
submodules: recursive
- name: get current tag
id: get_tag
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: update version
env:
TAG_VERSION: ${{ steps.get_tag.outputs.VERSION }}
run: |
sed -i -E 's/^ "version": "[^"]+",$/ "version": "'"$TAG_VERSION"'",/g' package.json
cat package.json
sed -i -E 's/^ "react-native-cardscan": "[^"]+",$/ "react-native-cardscan": "file:react-native-cardscan-'"$TAG_VERSION"'.tgz",/g' example/package.json
cat example/package.json
- name: update package lock
run: |
npm install
- name: update example package lock
run: |
cd example
npm pack ..
npm update
npm install
cd ..
- name: generate changelog
uses: heinrichreimer/[email protected]
with:
user: "getbouncer"
project: "react-native-cardscan"
repo: "getbouncer/react-native-cardscan"
token: ${{ secrets.SERVICE_PERSONAL_ACCESS_TOKEN }}
pullRequests: "true"
prWoLabels: "true"
issues: "true"
issuesWoLabels: "true"
author: "true"
base: "HISTORY.md"
unreleased: "true"
breakingLabels: "Versioning - BREAKING"
enhancementLabels: "Type - Enhancement, Type - Feature"
bugLabels: "Type - Fix, Bug - Fixed"
deprecatedLabels: "Type - Deprecated"
removedLabels: "Type - Removal"
securityLabels: "Security Fix"
excludeLabels: "Skip-Changelog"
- name: create commit
id: commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Automatic changelog update"
file_pattern: "package.json package-lock.json example/package.json CHANGELOG.md"
android-lint:
needs: finalize_release
name: Android lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: dependencies
run: |
npm install
cd example
npm install
cd ..
- name: lint
run: |
cd android
./gradlew lint
cd ..
- name: example-lint
run: |
cd example/android
./gradlew lint
cd ../..
- name: upload-artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-report
path: ${{ github.workspace }}/*/build/reports/
android-unit-test:
needs: finalize_release
name: Android unit test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: dependencies
run: |
npm install
cd example
npm install
cd ..
- name: test
run: |
cd android
./gradlew test
cd ..
- name: example-test
run: |
cd example/android
./gradlew test
cd ../..
- name: upload-artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-report
path: ${{ github.workspace }}/*/build/reports/
publish-npm:
needs: [ android-lint, android-unit-test ]
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
ref: "master"
- name: setup nodejs
uses: actions/setup-node@v1
with:
node-version: '12'
registry-url: 'https://registry.npmjs.org'
- name: prepublish
run: |
npm install
- name: publish to NPM
run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}