Skip to content

Release by navneel99 #1

Release by navneel99

Release by navneel99 #1

name: Publish ADaaS Library
run-name: "Release ${{ inputs.release-type }} by ${{ github.actor }}"
on:
push:
branches:
- main
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2 # Fetch the current and the previous commit
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.17
registry-url: https://registry.npmjs.org/
scope: '@devrev'
token: ${{ secrets.NPMJS_NPM_TOKEN }}
- run: npm ci
- run: npm run build
- run: |
CURRENT_VERSION=$(jq -r .version package.json)
PREVIOUS_VERSION=$(git show HEAD^:package.json | jq -r .version)
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
echo "version_bumped=true" >> "$GITHUB_ENV"
else
echo "Version $CURRENT_VERSION has not been changed"
echo "version_bumped=false" >> "$GITHUB_ENV"
fi
- name: Publish to registry
if: ${{ env.version_bumped == 'true' }}
run: npm publish --verbose --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_NPM_TOKEN}}