Skip to content

Update Angular & other deps (#22) #14

Update Angular & other deps (#22)

Update Angular & other deps (#22) #14

name: cps-mdoc-viewer - Bump, Build & Publish
on:
push:
branches:
- 'master'
paths:
- 'projects/cps-mdoc-viewer/**'
- '.github/workflows/cps-mdoc-viewer-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-mdoc-viewer
run: |
git config user.name github-actions
git config user.email [email protected]
version=$(npm version patch -m "Bump version to %s")
echo "::set-output name=version::$version"
- name: Commit and push
working-directory: projects/cps-mdoc-viewer
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-mdoc-viewer/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('projects/cps-mdoc-viewer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: npm ci
- name: Build cps-mdoc-viewer library
run: npm run build
- name: Print current version
working-directory: dist/cps-mdoc-viewer
run: npm version
- name: Publish to NPM registry
working-directory: dist/cps-mdoc-viewer
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}