Skip to content

Commit

Permalink
bump(patch) - Setup build process and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
2snEM6 committed May 25, 2022
1 parent 473129d commit 095b1c4
Show file tree
Hide file tree
Showing 3 changed files with 18,720 additions and 6 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
env:
TAG: patch
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0

- shell: bash
name: "Parse GIT Information"
run: |
commit_message=$(git log --format=%B -n 1 ${{ github.sha }})
echo "MESSAGE=$commit_message" >> $GITHUB_ENV
- shell: bash
name: "Generate new version"
run: |
regex='^bump\((minor|patch|major)\)'
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
if [[ $MESSAGE =~ $regex ]]; then
npm version $(echo ${BASH_REMATCH[1]})
else
npm version prerelease --preid=$(git log --pretty=format:'%h' -n 1)
fi
- uses: actions/setup-node@v1
with:
node-version: '14.x'

- name: "Setup registry"
run: |
echo "//npm.pkg.github.com/:_authToken=$NPM_TOKEN" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: npm publish --registry https://npm.pkg.github.com
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- shell: bash
name: "Push New version"
if: success()
run: |
git push origin --follow-tags
Loading

0 comments on commit 095b1c4

Please sign in to comment.