-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
variables: | ||
TEST_IMAGE: "node:14-alpine" | ||
BUILD_IMAGE: "gitlab.paymoapp.com:5555/envscripts/img-ubuntu-base" | ||
|
||
# Mixins | ||
.only_any_v_tags: | ||
only: | ||
- /^v[0-9]+\.[0-9]+\.[0-9]+/ | ||
except: | ||
- branches | ||
|
||
.only_release_v_tags: | ||
only: | ||
- /^v[0-9]+\.[0-9]+\.[0-9]+$/ | ||
except: | ||
- branches | ||
|
||
.job_test: | ||
image: $TEST_IMAGE | ||
stage: test | ||
rules: | ||
- if: $CI_MERGE_REQUEST_ID | ||
- if: $CI_COMMIT_TAG | ||
before_script: | ||
- npm ci --ignore-scripts | ||
|
||
stages: | ||
- test | ||
- build-addon | ||
- publish | ||
|
||
# Test stage | ||
lint: | ||
extends: | ||
- .job_test | ||
script: | ||
- npm run lint | ||
|
||
typecheck: | ||
extends: | ||
- .job_test | ||
script: | ||
- npm run typecheck | ||
|
||
# Build-addon stage | ||
build-addon-windows: | ||
extends: | ||
- .only_any_v_tags | ||
stage: build-addon | ||
tags: | ||
- win | ||
before_script: | ||
- npm config set msvs_version 2022 | ||
- npm ci --ignore-scripts | ||
script: | ||
- npm run build:gyp | ||
- npm run publish:bindings | ||
needs: | ||
- lint | ||
- typecheck | ||
|
||
# Publish stage | ||
build-library: | ||
extends: | ||
- .only_any_v_tags | ||
image: $BUILD_IMAGE | ||
stage: publish | ||
before_script: | ||
- npm ci --ignore-scripts | ||
script: | ||
- npm run build:ts | ||
- npm set //registry.npmjs.org/:_authToken $NPM_TOKEN | ||
- npm publish --access public | ||
- LAST_RELEASE="$(git describe --abbrev=0 --tags ${CI_COMMIT_TAG}^)" | ||
- CHANGELOG="$(git diff -U0 $LAST_RELEASE $CI_COMMIT_TAG CHANGELOG.md | grep -E "^\+" | grep -vE "^\+\+\+" | grep -vE "^\+#+ \[" | sed "s/^\+//")" | ||
- > | ||
curl -sSL -X POST -H "JOB-TOKEN: $CI_JOB_TOKEN" -H "Content-type: application/json" -d "{ \"name\": $(echo $CI_COMMIT_TAG | jq -Ra .), \"tag_name\": $(echo $CI_COMMIT_TAG | jq -Ra .), \"description\": $(echo "$CHANGELOG" | jq -Rsa .) }" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases | ||
artifacts: | ||
paths: | ||
- dist | ||
expire_in: 12h | ||
needs: | ||
- lint | ||
- typecheck |