fix: package.json & package-lock.json to reduce vulnerabilities #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to NPM | |
on: | |
# push: | |
# tags: | |
# - '*' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: deploy | |
# if Running on the default branch | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci --no-audit | |
- run: npm run build:lib | |
- name: Publish to npm | |
id: publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
# dry-run: true | |
- if: steps.publish.outputs.type != 'none' | |
run: | | |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | |
create-release: | |
runs-on: ubuntu-latest | |
# if Running on the default branch | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get the new tag version | |
id: tag_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Create draft release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true |