Skip to content

Commit

Permalink
Integrating build:prerelease job for publishing staging NPM packages
Browse files Browse the repository at this point in the history
Changing to typescript-demo-lib-native
  • Loading branch information
CMCDragonkai committed May 22, 2022
1 parent 5527ce8 commit 5249a05
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 70 deletions.
119 changes: 56 additions & 63 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,21 @@ check:lint:
npm run lint;
'
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- when: always

check:nix-dry:
stage: check
needs: []
script:
- nix-build -v -v --dry-run ./release.nix
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual
- when: always

check:test:
stage: check
Expand All @@ -81,19 +79,15 @@ check:test:
junit:
- ./tmp/junit.xml
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_BRANCH != 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual
# This job will be overridden by `build:linux`
- if: $CI_COMMIT_BRANCH == 'staging'
when: never
- when: always

build:linux:
stage: build
needs:
- check:lint
- job: check:lint
optional: true
script:
- >
nix-shell --run '
Expand All @@ -107,17 +101,17 @@ build:linux:
- ./tmp/junit.xml
paths:
- ./prebuilds/
# Only the build:linux preserves the dist
- ./dist
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

build:windows:
stage: build
needs:
- check:lint
- job: check:lint
optional: true
tags:
- windows
before_script:
Expand All @@ -138,16 +132,14 @@ build:windows:
paths:
- ./prebuilds/
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

build:macos:
stage: build
needs:
- check:lint
- job: check:lint
optional: true
tags:
- shared-macos-amd64
image: macos-11-xcode-12
Expand All @@ -174,11 +166,30 @@ build:macos:
paths:
- ./prebuilds/
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

build:prerelease:
stage: build
needs:
- build:linux
- build:windows
- build:macos
# Don't interrupt publishing job
interruptible: false
allow_failure: true
before_script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
script:
- >
nix-shell --run '
npm publish --tag prerelease --access public;
'
after_script:
- rm -f ./.npmrc
rules:
# Only prerelease tag
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/

integration:builds:
stage: integration
Expand Down Expand Up @@ -213,11 +224,8 @@ integration:builds:
paths:
- ./builds/
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

integration:nix:
stage: integration
Expand All @@ -232,11 +240,8 @@ integration:nix:
)"
- $build_application/bin/typescript-demo-lib
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

integration:docker:
stage: integration
Expand All @@ -253,11 +258,8 @@ integration:docker:
- image="$(docker load --input ./builds/*docker* | cut -d' ' -f3)"
- docker run "$image"
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

integration:linux:
stage: integration
Expand All @@ -267,11 +269,8 @@ integration:linux:
script:
- for f in ./builds/*-linux-*; do "$f"; done
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

integration:windows:
stage: integration
Expand All @@ -282,11 +281,8 @@ integration:windows:
script:
- Get-ChildItem -File ./builds/*-win-* | ForEach {& $_.FullName}
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

integration:macos:
stage: integration
Expand All @@ -298,11 +294,8 @@ integration:macos:
script:
- for f in ./builds/*-macos-x64*; do "$f"; done
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

# packages:
# stage: release
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TypeScript-Demo-Lib
# TypeScript-Demo-Lib-Native

[![pipeline status](https://gitlab.com/MatrixAI/open-source/TypeScript-Demo-Lib/badges/master/pipeline.svg)](https://gitlab.com/MatrixAI/open-source/TypeScript-Demo-Lib/commits/master)
[![pipeline status](https://gitlab.com/MatrixAI/open-source/TypeScript-Demo-Lib-Native/badges/master/pipeline.svg)](https://gitlab.com/MatrixAI/open-source/TypeScript-Demo-Lib-Native/commits/master)

## Installation

Expand Down Expand Up @@ -174,7 +174,7 @@ This has to be done to both `node2nixProd` and `node2nixDev`.
npm run docs
```

See the docs at: https://matrixai.github.io/TypeScript-Demo-Lib/
See the docs at: https://matrixai.github.io/TypeScript-Demo-Lib-Native/

### Publishing

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@matrixai/typescript-demo-lib",
"name": "@matrixai/typescript-demo-lib-native",
"version": "1.3.1",
"bin": {
"typescript-demo-lib": "dist/bin/typescript-demo-lib.js"
},
"author": "Roger Qiu",
"description": "TypeScript Demo Library Project",
"description": "TypeScript Demo Library Native Project",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/MatrixAI/TypeScript-Demo-Lib.git"
"url": "https://github.com/MatrixAI/TypeScript-Demo-Lib-Native.git"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in
PKG_CACHE_PATH = utils.pkgCachePath;
PKG_IGNORE_TAG = 1;
shellHook = ''
echo 'Entering Typescript-Demo-Lib'
echo 'Entering Typescript-Demo-Lib-Native'
set -o allexport
. ./.env
set +o allexport
Expand Down

0 comments on commit 5249a05

Please sign in to comment.