Skip to content

#162 Create composition page for table component (#169) #69

#162 Create composition page for table component (#169)

#162 Create composition page for table component (#169) #69

name: CPS UI Kit - Bump, Build & Publish
on:
push:
branches:
- 'master'
paths:
- 'projects/cps-ui-kit/**'
- '.github/**'
jobs:
version-bump:
if: "!contains(github.event.head_commit.message, 'Bump version to')"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js v16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: Bump version
id: bump
working-directory: projects/cps-ui-kit
run: |
git config user.name github-actions
git config user.email [email protected]
version=$(npm version minor -m "Bump version to %s")
echo "::set-output name=version::$version"
- name: Commit and push
working-directory: projects/cps-ui-kit
run: |
git add package.json
git commit -m "Bump version to ${{ steps.bump.outputs.version }}"
git push origin HEAD:master
publish:
needs: version-bump
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch latest commits
run: git pull origin master
- name: Use Node.js v16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: projects/cps-ui-kit/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('projects/cps-ui-kit/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: npm ci
- name: Build CPS UI Kit Component Library
run: npm run build
- name: Print current version
working-directory: dist/cps-ui-kit
run: npm version
- name: Publish to NPM registry
working-directory: dist/cps-ui-kit
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}