Merge pull request #10 from lewxdev/fix-typings #1
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
# based on https://github.com/azu/npm-github-package-example | |
name: Publish | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "!*" | |
jobs: | |
publish: | |
name: 🚀 Publish to npm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: "https://npm.pkg.github.com" | |
- run: npm clean-install | |
- run: npm test | |
# Publish to npm if this version is not published | |
- run: | | |
npx can-npm-publish --yes --verbose && npm publish || echo "Does not publish" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
# Push tag to GitHub if the version's tag is not tagged | |
- run: node --print '`PACKAGE_VERSION=${require("package.json").version}`' >> $GITHUB_ENV | |
- uses: pkgdeps/git-tag-action@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
github_repo: ${{ github.repository }} | |
version: ${{ env.PACKAGE_VERSION }} | |
git_commit_sha: ${{ github.sha }} | |
git_tag_prefix: "v" |