Skip to content

Commit

Permalink
add publish workflow (only runs on main)
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed May 6, 2024
1 parent c6be13e commit d0de4ea
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish NPM package @dev version

# This workflow runs whenever a commit is pushed on main
on:
push:
branches:
- main

jobs:
publish-npm-package:
name: Publish NPM package
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node & NPM
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

# New version will be <npm version>.<commit hash>, e.g. 1.1.1-dev.0a4c598
- name: Adjust package version according to branch & commit
run: npm version $(node --print 'require("./package.json").version').$(git rev-parse --short HEAD) --no-git-tag-version --allow-same-version

- name: Publish NPM package with @dev tag
run: npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit d0de4ea

Please sign in to comment.