Skip to content

feature: update npm publish workflow to include version bumping and i… #1

feature: update npm publish workflow to include version bumping and i…

feature: update npm publish workflow to include version bumping and i… #1

name: workflow - publish npm comanda sdk package

Check failure on line 1 in .github/workflows/publish-npm-package-pipeline.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-npm-package-pipeline.yml

Invalid workflow file

(Line: 22, Col: 14): Unexpected value '', (Line: 23, Col: 5): Unexpected value 'run'
on:
push:
branches:
- master
- development
paths:
- 'Artifacts/Comanda.Internal.Sdk/**'
pull_request:
branches:
- master
- development
paths:
- 'Artifacts/Comanda.Internal.Sdk/**'
jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
working-directory: Artifacts/Comanda.Internal.Sdk
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: install dependencies
run: npm install
- name: build
run: npm run build
- name: run tests
run: npm test
- name: prepare git for version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "ci: prepare repository for version bump" || echo "no changes to commit"
- name: bump version
run: |
if [ "${{ github.ref_name }}" = "master" ]; then
npm version minor -m "ci: bump minor version to %s"
elif [ "${{ github.ref_name }}" = "development" ]; then
npm version patch -m "ci: bump patch version to %s"
fi
- name: publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: prepare git for version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "ci: prepare repository for version bump" || echo "no changes to commit"