Skip to content

Commit

Permalink
chore: update publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
descorp committed Feb 8, 2023
1 parent e000f8a commit 8eda1e0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@ name: Publish Package

on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.version == '' && github.ref_name || inputs.version }}
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Update package version with tag
run: |
sed -i '' "s/ \"version\":.*$/ \"version\": \"${TAG}\",/g" "${PACKAGE_JSON_PATH}"
env:
TAG: ${{ github.ref }}
PACKAGE_JSON_PATH: 'package.json'

- run: yarn install --frozen-lockfile
# Update version in package.json
- run: |
sed -i 's/"version":.*$/"version": "${{ env.VERSION }}",/g' package.json
# Build and publish to npm
- run: yarn install --frozen-lockfile
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
CI: true
# Upload artifacts

0 comments on commit 8eda1e0

Please sign in to comment.