Skip to content

Bump version

Bump version #31

name: Node.js Package
on:
push:
branches:
- main
jobs:
checkVersion:
runs-on: ubuntu-latest
outputs:
newVersion: ${{ steps.newVersion.outputs.newVersion }}
version: ${{ steps.getVersion.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: getVersion
run: echo "version=$(cat package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
- id: newVersion
env:
PACKAGE_VERSION: ${{ steps.getVersion.outputs.version }}
run: >-
echo "newVersion=$([ "$(npm view @bad-software/eslint-config version)" != "$PACKAGE_VERSION" ] && echo 'true' || echo 'false' )" >> "$GITHUB_OUTPUT"
githubRelease:
runs-on: ubuntu-latest
needs: checkVersion
if: needs.checkVersion.outputs.newVersion == 'true'
steps:
- uses: actions/checkout@v4
- run: gh release create -t "v${PACKAGE_VERSION}" "v${PACKAGE_VERSION}" --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_VERSION: ${{ needs.checkVersion.outputs.version }}
npmPublish:
runs-on: ubuntu-latest
needs: checkVersion
if: needs.checkVersion.outputs.newVersion == 'true'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
scope: '@bad-software'
- run: yarn --frozen-lockfile
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}