1 Commits
Author SHA1 Message Date
Timi ab482ca4da feat: rename package to @timi/ts
Release / release (pull_request) Successful in 8s
2026-11-23 20:28:05 +08:00
3 changed files with 15 additions and 26 deletions
+12 -23
View File
@@ -2,19 +2,19 @@ name: Release
# 发版规则:dev 合并到 master,且合并请求标题为 vX.X.X
# 标题不是 vX.X.X 时只做构建验证,不发布
# 也支持手动触发,按 package.json 版本发布,用于失败后重发
on:
pull_request:
branches:
- master
types:
- closed
workflow_dispatch:
jobs:
release:
runs-on: act_runner_node
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
if: ${{ github.event.pull_request.merged == true }}
env:
NEXUS_AUTH: ${{ secrets.NEXUS_AUTH }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -22,16 +22,10 @@ jobs:
- name: Resolve release version
id: version
run: |
pkg_version=$(node -p "require('./package.json').version")
echo "package.json 版本:$pkg_version"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "手动触发,按 package.json 版本发布"
echo "version=$pkg_version" >> $GITHUB_OUTPUT
echo "publish=true" >> $GITHUB_OUTPUT
exit 0
fi
title="${{ github.event.pull_request.title }}"
pkg_version=$(node -p "require('./package.json').version")
echo "PR 标题:$title"
echo "package.json 版本:$pkg_version"
if echo "$title" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
if [ "v$pkg_version" != "$title" ]; then
echo "FAIL: 标题 $title 与 package.json 版本 $pkg_version 不一致"
@@ -45,22 +39,17 @@ jobs:
fi
- name: Configure nexus auth
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
if [ -z "$NEXUS_USERNAME" ] || [ -z "$NEXUS_PASSWORD" ]; then
echo "FAIL: 缺少 secrets.NEXUS_USERNAME 或 secrets.NEXUS_PASSWORD"
if [ -z "$NEXUS_AUTH" ]; then
echo "FAIL: 缺少 secrets.NEXUS_AUTH"
exit 1
fi
auth=$(printf '%s:%s' "$NEXUS_USERNAME" "$NEXUS_PASSWORD" | base64 | tr -d '\n')
{
echo "//nexus.imyeyu.com/repository/npm-group/:_auth=${auth}"
echo "//nexus.imyeyu.com/repository/npm-group/:_auth=${NEXUS_AUTH}"
echo "//nexus.imyeyu.com/repository/npm-group/:always-auth=true"
echo "//nexus.imyeyu.com/repository/npm-timi/:_auth=${auth}"
echo "//nexus.imyeyu.com/repository/npm-timi/:_auth=${NEXUS_AUTH}"
echo "//nexus.imyeyu.com/repository/npm-timi/:always-auth=true"
} > ~/.npmrc
echo "OK: nexus 认证已配置"
- name: Install dependencies
run: pnpm install --frozen-lockfile
@@ -74,8 +63,8 @@ jobs:
- name: Ensure version not published
if: ${{ steps.version.outputs.publish == 'true' }}
run: |
if npm view "timi-ts@${{ steps.version.outputs.version }}" version > /dev/null 2>&1; then
echo "FAIL: timi-ts@${{ steps.version.outputs.version }} 已存在于 nexus,请提升 package.json 版本"
if npm view "@timi/ts@${{ steps.version.outputs.version }}" version > /dev/null 2>&1; then
echo "FAIL: @timi/ts@${{ steps.version.outputs.version }} 已存在于 nexus,请提升 package.json 版本"
exit 1
fi
echo "OK: 版本未占用"
@@ -91,7 +80,7 @@ jobs:
GITEA_SERVER_URL: ${{ github.server_url }}
GITEA_INTERNAL_URL: ${{ vars.TIMI_GITEA_INTERNAL_URL }}
GITEA_REPOSITORY: ${{ github.repository }}
RELEASE_TAG: v${{ steps.version.outputs.version }}
RELEASE_TAG: ${{ github.event.pull_request.title }}
RELEASE_TARGET: ${{ github.sha }}
run: |
if [ -z "$GITEA_TOKEN" ]; then
+2 -2
View File
@@ -1,6 +1,6 @@
# timi-ts
# @timi/ts
平台无关的 TypeScript 通用工具库,供 `timi-web`、`timi-wxmp` 及其他业务项目复用。
平台无关的 TypeScript 通用工具库,供 `@timi/web`、`timi-wxmp` 及其他业务项目复用。
## 内容
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "timi-ts",
"name": "@timi/ts",
"version": "1.0.0",
"description": "平台无关的 TypeScript 通用工具库",
"license": "MIT",