@oliasoft-open-source/react-ui-library 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +42 -8
- package/package.json +1 -1
package/.gitlab-ci.yml
CHANGED
|
@@ -2,7 +2,7 @@ image: node:18
|
|
|
2
2
|
|
|
3
3
|
stages:
|
|
4
4
|
- test
|
|
5
|
-
-
|
|
5
|
+
- release
|
|
6
6
|
|
|
7
7
|
test:
|
|
8
8
|
stage: test
|
|
@@ -18,22 +18,56 @@ cache:
|
|
|
18
18
|
- node_modules/
|
|
19
19
|
- public/
|
|
20
20
|
|
|
21
|
+
# Publish the static docs site (including Storybook) to Gitlab pages upon merge to master
|
|
21
22
|
pages:
|
|
22
|
-
stage:
|
|
23
|
+
stage: release
|
|
24
|
+
only:
|
|
25
|
+
- master
|
|
23
26
|
script:
|
|
24
|
-
- npm install
|
|
27
|
+
- npm install --progress=false --no-save
|
|
25
28
|
- npm run build
|
|
26
29
|
- cp public/index.html public/404.html
|
|
27
30
|
artifacts:
|
|
28
31
|
paths:
|
|
29
32
|
- public
|
|
30
|
-
only:
|
|
31
|
-
- master
|
|
32
33
|
|
|
34
|
+
# Push a tag and publish the release to the public NPM registry upon merge to master
|
|
35
|
+
# Loosely inspired by:
|
|
36
|
+
# - https://markswanderingthoughts.nl/tagging-in-gitlab-ci-pipeline-using-deploy-keys/
|
|
37
|
+
# - https://www.garybell.co.uk/creating-a-release-with-gitlab-ci-and-composer/
|
|
33
38
|
publish:
|
|
34
|
-
stage:
|
|
39
|
+
stage: release
|
|
35
40
|
only:
|
|
36
41
|
- master
|
|
37
42
|
script:
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
# Get the version from package.json
|
|
44
|
+
- VERSION=$(node -p "require('./package.json').version")
|
|
45
|
+
# Prepare .npmrc
|
|
46
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
|
47
|
+
# Configure git
|
|
48
|
+
- mkdir -p ~/.ssh
|
|
49
|
+
- echo "$SSH_PRIVATE_KEY_TOOLKIT" > ~/.ssh/id_rsa; chmod 0600 ~/.ssh/id_rsa
|
|
50
|
+
- echo "StrictHostKeyChecking no " > /root/.ssh/config
|
|
51
|
+
- git config --global http.sslVerify false
|
|
52
|
+
- git config --global user.email "$GITLAB_USER_EMAIL"
|
|
53
|
+
- git config --global user.name "🤖 GitLab CI/CD"
|
|
54
|
+
- echo "setting origin remote to 'git@$CI_SERVER_HOST:$CI_PROJECT_PATH.git'"
|
|
55
|
+
- git remote rm origin
|
|
56
|
+
- git remote add origin git@$CI_SERVER_HOST:$CI_PROJECT_PATH.git
|
|
57
|
+
- git fetch --quiet
|
|
58
|
+
- git checkout "$CI_BUILD_REF_NAME"
|
|
59
|
+
# Only complete pipeline if version does not already exist
|
|
60
|
+
- >
|
|
61
|
+
if [ $(git tag -l "$VERSION") ]; then
|
|
62
|
+
echo "Version $VERSION already exists"
|
|
63
|
+
exit 1
|
|
64
|
+
else
|
|
65
|
+
# Tag a release in gitlab
|
|
66
|
+
echo "Tagging release in git"
|
|
67
|
+
git tag $VERSION -m "🤖 Tagged by Gitlab CI/CD Pipeline" -m "For further reference see $CI_PIPELINE_URL" -m "[skip ci]"
|
|
68
|
+
echo "Pushing tag to remote repository"
|
|
69
|
+
git push origin $VERSION --no-verify
|
|
70
|
+
# Publish the NPM package to the public NPM registry
|
|
71
|
+
echo "Publishing package to NPM registry"
|
|
72
|
+
npm publish
|
|
73
|
+
fi
|