Skip to content

chore: Use pull_request_target in workflow instead of pull_request (#… #4

chore: Use pull_request_target in workflow instead of pull_request (#…

chore: Use pull_request_target in workflow instead of pull_request (#… #4

name: Publish mobx-devtools-mst
on:
push:
paths: [ "packages/mobx-devtools-mst/**", ".github/**" ]
branches: [ "master" ]
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm run bootstrap
- name: Resolve new package version & Publish
working-directory: ./packages/mobx-devtools-mst
run: |
NAME=$(node -p "require('./package.json').name")
VERSION=$(node -p "require('./package.json').version.split('.').slice(0, 2).join('.')")
export LATEST=$(npm show "$NAME@$VERSION" version --json)
NEXT=$(node -p "JSON.parse(process.env.LATEST).at(-1).split('.').map((n, i) => i === 2 ? ++n : n).join('.')")
npm version $NEXT --git-tag-version false
npm run build
cat ./package.json
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}