Skip to content

Merge pull request #4 from ahasasjeb/codex/determine-if-library-needs… #37

Merge pull request #4 from ahasasjeb/codex/determine-if-library-needs…

Merge pull request #4 from ahasasjeb/codex/determine-if-library-needs… #37

Workflow file for this run

name: Publish to NPM
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Bump version and publish
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
if npm view mcfunction-highlight@$CURRENT_VERSION version &> /dev/null; then
npm version patch -m "Bump version to %s"
git push
git push --tags
fi
npm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}