Skip to content

Bump version and publish on npm #15

Bump version and publish on npm

Bump version and publish on npm #15

name: "Bump version and publish on npm"
on:
workflow_dispatch:
branches:
- "master"
jobs:
build-test-deploy:
name: Build, test, bump version and deploy the library on npm
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@master
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- uses: actions/checkout@master
- name: "Install dependency"
run: npm ci
# Workflow using with https://github.com/maks-stupak/gh-action-bump-version
# Based on the commit messages, increment the version from the latest release.
# - If the string "major" is found anywhere in any of the commit messages or descriptions the major version will be incremented.
# - If includes "minor" then the minor version will be increased.
# - If includes "patch" then the patch version will be increased.
- name: "Automated version bump for library"
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: ""
env:
PACKAGEJSON_DIR: "./projects/ngx-image-compress"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Automated version bump for demo app"
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: "demo-"
env:
PACKAGEJSON_DIR: "./"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build'
run: npm run build
- name: 'Test the library'
run: npm run test:lib
- name: 'Test the demo app'
run: npm run test:app
- name: "Ship the README.md with the library build"
run: cp ./README.md ./dist/ngx-image-compress/README.md
- name: "Ship the LICENSE"
run: cp ./LICENSE ./dist/ngx-image-compress/LICENSE
- name: "Publish the library on npm"
working-directory: ./dist/ngx-image-compress
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish