-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Introduce publish package pipeline #CCM-8
* based on release publishing
- Loading branch information
Showing
4 changed files
with
82 additions
and
1 deletion.
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,38 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
publish: | ||
name: Publish package | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Bump version | ||
run: yarn version --`./bin/ci/semver.sh` | ||
|
||
- name: Authenticate npm | ||
run: ./bin/ci/npm-auth.sh | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Publish | ||
run: cd ./dist && yarn publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
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,11 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
|
||
# Authorise npm for publishing | ||
cat <<NPMRC >> .npmrc | ||
@lmc-eu:registry=https://registry.npmjs.org/ | ||
//registry.npmjs.org/:_authToken=${NPM_TOKEN} | ||
NPMRC | ||
|
||
npm whoami |
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,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
function grep_word_from_git_commits_since_last_tag() { | ||
local commits=$(git log --oneline $(git describe --tags --abbrev=0 @^)..@ --grep="$1" 2> /dev/null) | ||
|
||
# Check exit code of last command, eg. the one that gets the commits | ||
# and normalize exit status if there is some unpredictable error (git or grep fail) | ||
if [ $? -ne 0 ]; then | ||
echo 2 | ||
elif [ -z "$commits" ]; | ||
then | ||
echo 0 | ||
else | ||
echo 1 | ||
fi | ||
} | ||
|
||
function get_version() { | ||
if [ `grep_word_from_git_commits_since_last_tag "BREAKING CHANGE"` -gt 0 ] | ||
then | ||
echo "major" | ||
elif [ `grep_word_from_git_commits_since_last_tag "Feat"` -gt 0 ] | ||
then | ||
echo "minor" | ||
else | ||
echo "patch" | ||
fi | ||
} | ||
|
||
get_version |
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