Skip to content

Commit

Permalink
feat: lint, bump tag, publish
Browse files Browse the repository at this point in the history
  • Loading branch information
AbigailDeng authored and AbigailDeng committed Jul 23, 2024
1 parent 2995bed commit 10510a4
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: publish
env:
CI: true
on:
push:
branches:
- master
tags:
- '!*'
jobs:
release:
name: Setup
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup Node
uses: actions/setup-node@v2
with:
node-version: 18.x
registry-url: 'https://npm.pkg.github.com'
- name: install
run: yarn install
- name: lint
run: npm lint
# Publish to npm if this version is not published
- name: publish
run: |
npx can-npm-publish --verbose
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish || (echo "npm publish failed" && exit 1)
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Push tag to GitHub if package.json version's tag is not tagged
- name: package-version
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
- name: package-version-to-git-tag
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'

0 comments on commit 10510a4

Please sign in to comment.