This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
forked from drodil/backstage-plugin-qeta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
92 lines (87 loc) · 3.01 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
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
kind: secret
name: artifactory_access_token
get:
path: artifactory-token?scope=artifactory-dv
---
kind: pipeline
type: docker
name: publish-packages
trigger:
event:
- push
branch:
- main
steps:
- name: setup-and-check
image: node:18-alpine
environment:
ACCESS_TOKEN:
from_secret: artifactory_access_token
commands:
- apk add -q --no-cache curl jq
- |
# retrieve artifactory's generated npm config
curl --location --silent --header "Authorization: Bearer $${ACCESS_TOKEN}" "https://nytimes.pe.jfrog.io/artifactory/api/npm/dv-backstage-plugins-npm-local/auth/nyt" > .npmrc
# this returns something like:
# @nyt:registry=https://nytimes.pe.jfrog.io/artifactory/api/npm/dv-backstage-plugins-npm-local/
# //nytimes.pe.jfrog.io/artifactory/api/npm/dv-backstage-plugins-npm-local/:_password=base64encoded($jwt)
# //nytimes.pe.jfrog.io/artifactory/api/npm/dv-backstage-plugins-npm-local/:username=vault-artifactory-internal-prd
# //nytimes.pe.jfrog.io/artifactory/api/npm/dv-backstage-plugins-npm-local/:email=ENTER_YOUR_EMAIL_HERE
# //nytimes.pe.jfrog.io/artifactory/api/npm/dv-backstage-plugins-npm-local/:always-auth=true
- |
for dir in ./plugins/*/; do
if [ -d "$dir" ]; then
cd "$dir"
PLUGIN_VERSION=$(cat package.json | jq '.version')
EXISTS=$(npm view "@nyt/$(basename "$dir")" versions --json | jq "any(.[]; select(. == $PLUGIN_VERSION))")
if [ "$EXISTS" = "false" ]; then
echo "need to publish version"
exit 0
fi
cd -
fi
done
echo "every package's version is already published"
exit 78
- name: install-dependencies
image: node:18-alpine
commands:
- yarn -v
- node -v
- yarn cache clean
- yarn install --check-cache
- name: publish-release-artifact
image: node:18-alpine
commands:
- yarn tsc
- apk add -q --no-cache jq
- |
for dir in plugins/*/; do
if [ -d "$dir" ]; then
cd "$dir"
PLUGIN_VERSION=$(cat package.json | jq '.version')
EXISTS=$(npm view "@nyt/$(basename "$dir")" versions --json | jq "any(.[]; select(. == $PLUGIN_VERSION))")
if [ "$EXISTS" == "false" ]; then
npm run build
npm publish
fi
cd -
fi
done
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel: dv-reliability-engineering-alerts
username: nytimes/nebula-backstage-plugins (publish)
template: >
{{#success build.status}}
:rocket: <{{build.link}}{{build.number}}|> ({{truncate build.commit 8}}) ${DRONE_TAG} publish succeeded!
{{else}}
:mega: <{{build.link}}|{{build.number}}> ({{truncate build.commit 8}}) ${DRONE_TAG} publish failed!
{{/success}}
when:
status:
- success
- failure