diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8d5941d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Release Published + +on: + release: + types: [published] + +jobs: + build: + name: Create Node.js Package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + + - name: Generate package + id: generate_package + run: echo ::set-output name=FILE::$(npm pack) + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{github.event.release.upload_url}} + asset_path: ./${{ steps.generate_package.outputs.FILE }} + asset_name: ${{ steps.generate_package.outputs.FILE }} + asset_content_type: application/gzip + + - name: Publish to npmjs + run: npm publish ${{ steps.generate_package.outputs.FILE }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}