Skip to content

Commit

Permalink
ci: export files for npm (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored Aug 12, 2024
1 parent cc7199a commit f1189e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ jobs:
- name: Determine NPM Tag
id: determine-npm-tag
run: |
VERSION_TAG="${{ github.event.inputs.version }}"
VERSION_TAG=${GITHUB_REF#refs/tags/v}
if [[ $VERSION_TAG == *"-"* ]]; then
echo "NPM_TAG=${VERSION_TAG#*-}" >> $GITHUB_ENV
echo ::set-output name=NPM_TAG::${VERSION_TAG#*-}
else
echo "NPM_TAG=latest" >> $GITHUB_ENV
echo ::set-output name=NPM_TAG::latest
fi
env:
GITHUB_REF: ${{ github.ref }}

- name: Publish to NPM
run: yarn publish --new-version ${{ github.event.inputs.version }} --tag ${{ env.NPM_TAG }} --no-git-tag-version
run: yarn publish --new-version ${GITHUB_REF#refs/tags/v} --tag ${{
steps.determine-npm-tag.outputs.NPM_TAG }} --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_REF: ${{ github.ref }}
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.js"
}
},
"keywords": [],
"author": "ZetaChain",
"license": "MIT",
Expand Down

0 comments on commit f1189e0

Please sign in to comment.