Skip to content

Commit 3648510

Browse files
feat(npm): publish from ci
2 parents 1340736 + b46be58 commit 3648510

File tree

8 files changed

+202
-32
lines changed

8 files changed

+202
-32
lines changed

.gitlab-ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
image: docker:latest
2+
3+
variables:
4+
IMAGE_TAG: $CI_REGISTRY_IMAGE
5+
IMAGE_TAG_CURRENT: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
6+
7+
stages:
8+
- build
9+
# - test
10+
- publish
11+
12+
build:
13+
stage: build
14+
before_script:
15+
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
16+
script:
17+
- docker build -t $IMAGE_TAG .
18+
- docker tag $IMAGE_TAG $IMAGE_TAG_CURRENT
19+
- docker push $IMAGE_TAG_CURRENT
20+
tags:
21+
- docker
22+
23+
#unit:
24+
# stage: test
25+
# before_script:
26+
# - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
27+
# script:
28+
# - docker run --name unit-$CI_COMMIT_SHA $IMAGE_TAG_CURRENT npm run test
29+
# after_script:
30+
# - docker rm unit-$CI_COMMIT_SHA
31+
# tags:
32+
# - docker
33+
34+
publish:
35+
stage: publish
36+
only:
37+
- master
38+
when: manual
39+
before_script:
40+
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
41+
script:
42+
- docker run --env NPM_AUTH_TOKEN --env VERSION --name unit-$CI_COMMIT_SHA $IMAGE_TAG_CURRENT ./npm-ci-publish.sh
43+
after_script:
44+
- docker rm unit-$CI_COMMIT_SHA
45+
tags:
46+
- docker

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:9-slim
2+
3+
# create app directory
4+
RUN mkdir /app
5+
WORKDIR /app
6+
7+
# Install app dependencies, using wildcard if package-lock exists
8+
COPY package.json /app
9+
COPY package-lock.json /app
10+
11+
# install dependencies
12+
RUN npm install
13+
14+
# Bundle app source
15+
COPY . /app
16+
17+
# set to production
18+
RUN export NODE_ENV=production

npm-ci-publish.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
sed -i -e "s/version\": \"0.0.0\"/version\": \"$VERSION\"/g" package.json
4+
sed -i -e "s/version\": \"0.0.0\"/version\": \"$VERSION\"/g" package-lock.json
5+
sed -i -e "s/version\": \"0.0.0\"/version\": \"$VERSION\"/g" plugin.xml
6+
7+
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
8+
npm publish
9+
rm .npmrc

package-lock.json

Lines changed: 110 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-plugin-airgap-secure-storage",
3-
"version": "1.0.0",
3+
"version": "0.0.0",
44
"author": "Papers GmbH <contact@papers.ch> (https://papers.ch)",
55
"cordova": {
66
"id": "cordova-plugin-airgap-secure-storage",
@@ -12,21 +12,32 @@
1212
},
1313
"description": "AirGap Secure Storage securely encrypts and stores sensitive information and data on your device",
1414
"main": "index.js",
15+
"bugs": {
16+
"url": "https://github.com/airgap-it/cordova-plugin-airgap-secure-storage/issues"
17+
},
18+
"homepage": "https://github.com/airgap-it/cordova-plugin-airgap-secure-storage#readme",
1519
"directories": {
1620
"test": "tests"
1721
},
1822
"scripts": {
19-
"test": "npm run test"
23+
"test": "jasmine"
2024
},
2125
"repository": {
2226
"type": "git",
23-
"url": "ssh://git@github.com:airgap-it/cordova-plugin-airgap-secure-storage.git"
27+
"url": "git+https://github.com/airgap-it/cordova-plugin-airgap-secure-storage.git"
2428
},
2529
"keywords": [
30+
"ecosystem:cordova",
31+
"cordova-android",
32+
"cordova-ios",
33+
"cordova-browser",
2634
"secure",
2735
"storage",
2836
"airgap",
2937
"crypto",
3038
"credentials"
31-
]
39+
],
40+
"devDependencies": {
41+
"jasmine": "^3.3.0"
42+
}
3243
}

plugin.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-airgap-secure-storage" version="1.0.0">
2+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-airgap-secure-storage" version="0.0.0">
33

44
<name>AirGap Secure Storage</name>
5-
<description></description>
6-
<license></license>
7-
<keywords></keywords>
5+
<description>AirGap Secure Storage securely encrypts and stores sensitive information and data on your device</description>
6+
<keywords>secure,storage,airgap,crypto,credentials</keywords>
7+
<repo>https://github.com/airgap-it/cordova-plugin-airgap-secure-storage.git</repo>
88

99
<!-- browser -->
1010
<platform name="browser">

tests/package.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/plugin.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)