-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (33 loc) · 1.11 KB
/
github-npm-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
on:
workflow_call:
inputs:
dist_tag:
description: NPM dist tag to publish to
required: true
type: string
node_version:
description: Node version to build on
default: "18"
required: false
type: string
package_manager:
default: npm
description: Package manager to use. Can be 'npm' or 'bun'
type: string
jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: ./.github/actions/npm-environment-setup
with:
package_manager: ${{ inputs.package_manager }}
node_version: ${{ inputs.node_version }}
registry_url: https://npm.pkg.github.com
- name: Update version to include commit hash
run: npm version "$(npm pkg get version | sed 's/\"//g')"-"$(date +%s)".${{ github.sha }} --allow-same-version --git-tag-version=false --tag-version-prefix=''
- name: Publish to ${{ inputs.dist_tag }} tag with npm registry
run: npm publish --tag ${{ inputs.dist_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}