-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
40 lines (38 loc) · 1.58 KB
/
.gitlab-ci.yml
File metadata and controls
40 lines (38 loc) · 1.58 KB
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
stages:
- build
- publish
# Build for public NPM package (for public NPM package for production)
build_package:
image: node:slim
stage: build
only:
- master
- npm-publish
before_script:
# Configure .npmrc to use the NOSi Nexus Sonatype credentials
- echo "Publishing version to sonatype.nosi.cv"
- echo "@igrp:registry=https://sonatype.nosi.cv/repository/igrp/" >> ~/.npmrc
- echo "//sonatype.nosi.cv/repository/igrp/:username=${SONATYPE_USERNAME}" >> ~/.npmrc
- echo "//sonatype.nosi.cv/repository/igrp/:_password=${SONATYPE_PASSWORD}" >> ~/.npmrc
script:
- npm install
- npm run build
- npm publish --registry=https://sonatype.nosi.cv/repository/igrp/
# Publish to public NPM registry (for public NPM registry for production)
publish_to_public_npm:
image: node:slim
stage: publish
only:
- npm-publish
before_script:
# Configure .npmrc to use the NPM Token for npmjs.org
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
# Set the version dynamically based on the package version from Nexus
- VERSION=$(npm show @igrp/igrp-studio-springboot-engine@latest version --registry=https://sonatype.nosi.cv/repository/igrp/)
- echo "Fetched version $VERSION from private Nexus"
# Pack the latest version from Nexus
- npm pack @igrp/igrp-studio-springboot-engine@$VERSION --registry=https://sonatype.nosi.cv/repository/igrp/
script:
# Publish the fetched package to npmjs.org
- echo "Publishing version $VERSION to npmjs.org"
- npm publish --access public --registry=https://registry.npmjs.org/