fix ifjs #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: npm ci | |
- name: Verify NPM package version | |
run: | | |
PACKAGE_VERSION=$(npm show @targoninc/fjs version) | |
if [ "${PACKAGE_VERSION}" == "$(jq -r .version package.json)" ]; then | |
echo "Package version already matches the version in package.json, skipping publish and aborting workflow..." | |
exit 1 | |
else | |
echo "Package version does not match the version in package.json, publishing..." | |
fi | |
build: | |
needs: check_version | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm ci | |
publish-npm: | |
needs: build | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.npm_token }} |