This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
add-deprecation-warning #398
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: Publish to NPM | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
- name: Get version | |
run: | | |
echo "PACKAGE_VERSION=$(jq ".version" package.json -r)" >> $GITHUB_ENV | |
- name: Check that the tag exists | |
uses: mukunku/tag-exists-action@v1.4.0 | |
id: checkTag | |
with: | |
tag: ${{ env.PACKAGE_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to NPM | |
uses: JS-DevTools/npm-publish@v2 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: 'public' | |
provenance: true | |
- name: Create a GitHub release | |
if: steps.checkTag.outputs.exists != 'true' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.PACKAGE_VERSION }} |