Add type module to package.json and bump version #41
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: Publish to npm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
verify: | |
name: Publish if pkg version changed | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
submodules: recursive | |
- name: Get package version | |
id: get_pkg_version | |
run: echo "pkg_version=$(cat package.json | jq -r .version)" >> "$GITHUB_OUTPUT" | |
- name: Get npm version | |
id: get_npm_version | |
run: echo "npm_version=$(npm view java-slang version)" >> "$GITHUB_OUTPUT" | |
- name: Stop if version has not changed | |
if: steps.get_pkg_version.outputs.pkg_version == steps.get_npm_version.outputs.npm_version | |
run: exit 1 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |