-
Notifications
You must be signed in to change notification settings - Fork 4
/
.drone.yml
63 lines (57 loc) · 1.64 KB
/
.drone.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
---
kind: pipeline
type: docker
name: default
workspace:
path: /src
steps:
- name: install-dependencies
image: gmetrixr/baseimage:node-18-dev-v1
commands:
# Substitution: parameter//substring/replacemenet. So "// \/ / -" means replace / with -
- echo "The image tag is ${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}"
- sudo chown -R node .
- pnpm install
- name: lint-and-build
image: gmetrixr/baseimage:node-18-dev-v1
commands:
- pnpm lint
- pnpm check
- pnpm build
- pnpm test
#Commits all modified files. npm publish doesn't work with unstaged changes
- name: npm-prepare-main
image: gmetrixr/baseimage:node-18-dev-v1
when:
branch: [main]
event:
exclude: [pull_request]
commands:
- |
/bin/sh -c 'git add -A; #Needed for git diff-index pick up new files
if git diff-index --quiet HEAD;
then #Run if no difference (exit code 0)
echo "No changes to commit";
else #Run if there is a difference difference (exit code 1)
git commit -am "Publish related changes. [CI SKIP]";
fi'
- export N=`node -p require\(\'./package.json\'\).name` && echo $N
- "pnpm version patch --message \"v%s: $N [CI SKIP]\""
- git push origin ${DRONE_BRANCH}
- git push --tags origin ${DRONE_BRANCH}
- name: npm-publish-main
image: gmetrixr/baseimage:node-18-dev-v1
when:
branch: [ main ]
event:
exclude: [ pull_request ]
environment:
REGISTRY_TOKEN:
from_secret: npm_token
commands:
- npm set registry https://registry.npmjs.org/
- npm set //registry.npmjs.org/:_authToken $REGISTRY_TOKEN
- npm publish
trigger:
branch: [main]
event: [push, pull_request]