Skip to content

Commit

Permalink
Added githib action to publish package
Browse files Browse the repository at this point in the history
  • Loading branch information
aeinbu committed Feb 16, 2020
1 parent a9ae0ed commit 1d695a4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Node.js Package

on:
release:
types: [created]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm test

publish-npm:
env:
tag: ${{ github.event.release.tag_name }}
needs: build
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 ci
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Arjan Einbu"
- run: npm version ${tag}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-gpr:
env:
tag: ${{ github.event.release.tag_name }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@aeinbu'
- run: npm ci
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Arjan Einbu"
- run: npm version ${tag}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "tsc",
"prepare": "npm run build",
"prepublishOnly": "npm test",
"postversion": "git push --tags",
"version" : "git add package.json",
"lint-autofix": "eslint --fix src/**/* tests/**/*"
},
"repository": {
Expand Down

0 comments on commit 1d695a4

Please sign in to comment.