Skip to content

Commit d4be49e

Browse files
committedOct 14, 2019
Add .gitlab-ci.yml
1 parent 9401b8c commit d4be49e

File tree

4 files changed

+1327
-23
lines changed

4 files changed

+1327
-23
lines changed
 

‎.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
node_modules
22
dist
3-
release
3+
4+
Home-darwin-x64
5+
Home-linux-x64
6+
Home-win32-x64
7+
hap-server-electron-app.tgz
8+
Home.app.zip
9+
hap-server-electron-app.dpkg
410

511
data

‎.gitlab-ci.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# This file is a template, and might need editing before it works on your project.
2+
# Official framework image. Look for the different tagged releases at:
3+
# https://hub.docker.com/r/library/node/tags/
4+
image: node:12
5+
6+
# This folder is cached between builds
7+
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
8+
cache:
9+
paths:
10+
- node_modules/
11+
12+
build:
13+
stage: build
14+
script:
15+
- npm --color="always" install
16+
- npx tsc
17+
18+
# npm package
19+
- PACKAGE_PATH=`npm --color="always" pack`
20+
- mv $PACKAGE_PATH hap-server-electron-app.tgz
21+
22+
# macOS
23+
- npx electron-packager . Home --platform darwin --arch x64 --ignore "src|data|\.(d\.ts|map|git)|package-lock|tsconfig"
24+
- cd Home-darwin-x64
25+
- zip -r ../Home.app.zip Home-darwin-x64/Home.app/*
26+
- cd ..
27+
28+
# Linux + dpkg
29+
- npx electron-packager . Home --platform linux --arch x64 --ignore "src|data|\.(d\.ts|map|git)|package-lock|tsconfig"
30+
31+
- npx electron-installer-debian --src Home-linux-x64 --dest . --arch amd64
32+
- mv Home_*_amd64.deb hap-server-electron-app.dpkg
33+
34+
# Windows
35+
# - npx electron-packager . Home --platform win32 --arch x64 --ignore "src|data|\.(d\.ts|map|git)|package-lock|tsconfig"
36+
artifacts:
37+
paths:
38+
- dist
39+
- hap-server-electron-app.tgz
40+
41+
- Home-darwin-x64
42+
- Home-linux-x64
43+
# - Home-win32-x64
44+
45+
- Home.app.zip
46+
- hap-server-electron-app.dpkg
47+
only:
48+
changes:
49+
- .gitlab-ci.yml
50+
- package-lock.json
51+
- tsconfig.json
52+
- src/**/*
53+
54+
audit:
55+
stage: test
56+
script:
57+
- npm audit --json > npm-audit.json || true
58+
- npm --color="always" audit
59+
artifacts:
60+
paths:
61+
- npm-audit.json
62+
when: always
63+
only:
64+
changes:
65+
- .gitlab-ci.yml
66+
- package-lock.json
67+
cache:
68+
paths:
69+
- node_modules/
70+
policy: pull
71+
when: always
72+
allow_failure: true
73+
74+
publish-npm:
75+
stage: deploy
76+
script:
77+
- cd release
78+
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
79+
- npm --color="always" publish
80+
dependencies:
81+
- build
82+
only:
83+
refs:
84+
- /^v.*$/
85+
variables:
86+
- $NPM_TOKEN
87+
except:
88+
- branches
89+
cache:
90+
paths:
91+
- node_modules/
92+
policy: pull
93+
94+
publish-github:
95+
stage: deploy
96+
script:
97+
- cd release
98+
- echo "//npm.pkg.github.com/:_authToken=${GITHUB_NPM_TOKEN}" > .npmrc
99+
- npm --color="always" --registry=https://npm.pkg.github.com/ publish
100+
dependencies:
101+
- build
102+
only:
103+
refs:
104+
- /^v.*$/
105+
variables:
106+
- $GITHUB_NPM_TOKEN
107+
except:
108+
- branches
109+
cache:
110+
paths:
111+
- node_modules/
112+
policy: pull

0 commit comments

Comments
 (0)
Please sign in to comment.