name: Npm Publish
|
|
|
|
on:
|
|
release:
|
|
types: [created]
|
|
|
|
jobs:
|
|
publish-npm:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12
|
|
registry-url: https://registry.npmjs.org/
|
|
- run: npm version --no-git-tag-version $TAG
|
|
env:
|
|
TAG: ${{ github.event.release.tag_name }}
|
|
- run: npm publish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
|
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
- run: git fetch origin master
|
|
- run: git config --local user.email "action@github.com"
|
|
- run: git config --local user.name "GitHub Publish Action"
|
|
- run: git checkout master
|
|
- run: git add package.json
|
|
- run: git commit --message "release $TAG"
|
|
env:
|
|
TAG: ${{ github.event.release.tag_name }}
|
|
- run: git remote add deploy https://${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
|
- run: git push deploy master
|