Skip to content

Commit

Permalink
fix: update release
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangwy committed Oct 15, 2024
1 parent a59f10e commit 90683d9
Show file tree
Hide file tree
Showing 11 changed files with 853 additions and 37,841 deletions.
94 changes: 58 additions & 36 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,63 @@
name: build and publish

on:
release:
types: [created]
pull_request:
branches:
- main
push:
branches:
- main
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: latest
- run: pnpm install
- run: pnpm run build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: latest
registry-url: https://registry.npmjs.org/
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH}}
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run build

- name: Configure git
run: |
git config --global user.name "${{ secrets.GITHUB_ACTOR }}"
git config --global user.email "${{ secrets.GITHUB_ACTOR }}@users.noreply.github.com"
- name: Get version bump
id: version
run: |
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
if [[ $LAST_COMMIT_MSG == fix:* ]]; then
echo "bump=patch" >> $GITHUB_OUTPUT
elif [[ $LAST_COMMIT_MSG == feat:* ]]; then
echo "bump=minor" >> $GITHUB_OUTPUT
elif [[ $LAST_COMMIT_MSG == chore:* ]]; then
echo "bump=major" >> $GITHUB_OUTPUT
else
echo "bump=patch" >> $GITHUB_OUTPUT
fi
- name: Bump version
run: pnpm standard-version --release-as ${{ steps.get-version-bump.outputs.bump }}

- name: Push changes
run: |
git push --follow-tags origin main
- name: Publish to npm
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
Loading

0 comments on commit 90683d9

Please sign in to comment.