Skip to content

fix: πŸ› (ci) build scripts #6

fix: πŸ› (ci) build scripts

fix: πŸ› (ci) build scripts #6

Workflow file for this run

name: 发布 npm
on:
push:
tags:
- "v*.*.*" # εŒΉι…εƒ v1.0.0-beta.0 θΏ™ζ ·ηš„η‰ˆζœ¬ζ ‡η­Ύ
permissions:
contents: write
discussions: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Parse tag and set version
id: parse_tag
run: |
# 从 GitHub ηš„ tag δΈ­ζε–η‰ˆζœ¬δΏ‘ζ―
tag_name="${GITHUB_REF#refs/tags/}"
version="${tag_name#v}"
if [[ "$tag_name" == *"-alpha"* ]]; then
prerelease=true
tag="alpha"
elif [[ "$tag_name" == *"-beta"* ]]; then
prerelease=true
tag="beta"
elif [[ "$tag_name" == *"-rc"* ]]; then
prerelease=true
tag="rc"
else
prerelease=false
tag="latest"
fi
echo "Tag: $tag_name"
echo "Version: $version"
echo "Is prerelease: $prerelease"
echo "::set-output name=prerelease::$prerelease"
echo "::set-output name=version::$version"
echo "::set-output name=tag::$tag"
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: |
bun i
bun run build
bun run scripts/ver.ts
# - name: Update package versions with changesets
# run: |
# npx changeset version # ζ›΄ζ–°η‰ˆζœ¬ε·
- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://registry.npmjs.org/
- name: Publish to npm
run: |
bun run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ steps.parse_tag.outputs.prerelease }}
tag_name: ${{ steps.parse_tag.outputs.version }}