Bump version to v17.26.0 #241
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
name: CPS UI Kit - Bump, Build & Publish | |
on: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'projects/cps-ui-kit/**' | |
- '.github/workflows/cps-ui-kit-publish.yml' | |
jobs: | |
version-bump: | |
if: "!contains(github.event.head_commit.message, 'Bump version to') && !contains(github.event.head_commit.message, '#SkipVersionBump')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Use Node.js v20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.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 | |
if: always() && !cancelled() && !failure() && !contains(github.event.head_commit.message, 'Bump version to') | |
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 v20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.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 }} |