Skip to content

Commit

Permalink
ci: add publish to npm workflow
Browse files Browse the repository at this point in the history
The workflow first updates the version in the package.json, commits that change and then runs `npm publish`. It is triggered by GitHub releases and can be manually dispatched.
  • Loading branch information
zepatrik authored and aeneasr committed Nov 26, 2020
1 parent 93c02d2 commit 77ece8d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish to npm registry

on:
release:
types:
- created
workflow_dispatch:
inputs:
version:
required: true
description: The version to release

jobs:
btp:
runs-on: ubuntu-latest
name: Publish
steps:
- uses: actions/checkout@v2
- name: Bump version
run: |-
cat <<< $(jq '.version = (env.RELEASE_VERSION | sub("(^refs/tags/v)|(^v)"; ""))' package.json) > package.json
git config --local user.email "zepatrik@users.noreply.github.com"
git config --local user.name "zepatrik"
git add package.json
git commit -m "autogen: bump version"
git push -f "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master
env:
RELEASE_VERSION: ${{ github.event.inputs.version || github.ref }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_AENEASR }}

0 comments on commit 77ece8d

Please sign in to comment.