name: Publish to npm Registry

on:
  pull_request:
    types: closed
jobs:
  publish:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged
    steps:
      - uses: actions/checkout@v1
        with:
          ref: refs/heads/master
      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 10
          registry-url: "https://registry.npmjs.org"
      - name: npm install
        run: npm install
      - name: version and publish
        run: |
          git config user.name $GITHUB_ACTOR
          git config user.email gh-actions-${GITHUB_ACTOR}@github.com
          git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
          echo "//registry.npmjs.com/:_authToken=$NPM_API_TOKEN" >> ~/.npmrc

          npm run prerelease
          npm version minor --force -m "Version %s [build-skip]"
          npm set registry https://registry.npmjs.org/
          npm publish

          git push gh-origin HEAD:master --tags
        env:
          CI: true
          NPM_API_TOKEN: ${{ secrets.NPM_API_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

name: Publish to npm Registry

on:
  pull_request:
    types: closed
jobs:
  publish:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged
    steps:
      - uses: actions/checkout@v1
        with:
          ref: refs/heads/master
      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 10
          registry-url: "https://registry.npmjs.org"
      - name: npm install
        run: npm install
      - name: version and publish
        run: |
          git config user.name $GITHUB_ACTOR
          git config user.email gh-actions-${GITHUB_ACTOR}@github.com
          git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
          echo "//registry.npmjs.com/:_authToken=$NPM_API_TOKEN" >> ~/.npmrc

          npm run prerelease
          npm version minor --force -m "Version %s [build-skip]"
          npm publish

          git push gh-origin HEAD:master --tags
        env:
          CI: true
          NPM_API_TOKEN: ${{ secrets.NPM_API_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Remove npm set registry (unneeded)
Remove npm set registry (unneeded)
