Skip to content

Commit

Permalink
ci(workflow): 优化 GitHub Actions 工作流并更新版本号
Browse files Browse the repository at this point in the history
- 重新排序 pnpm 设置和 Node.js 设置步骤
- 改进错误处理和输出信息
- 更新 README 文件中的版本信息
- 在 package.json 中更新版本号至 1.0.6
- 优化 release 工作流中的错误处理和日志输出
  • Loading branch information
h7ml committed Dec 11, 2024
1 parent a1969a5 commit 4cfa2aa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Get pnpm store directory
shell: bash
run: |
Expand All @@ -44,19 +44,24 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: |
pnpm install --no-frozen-lockfile || (echo "Dependency installation failed" && exit 1)
- name: Check format
run: pnpm format:check
run: |
pnpm format:check || echo "Format check failed"
- name: Run lint
run: pnpm lint
run: |
pnpm lint || echo "Linting issues detected"
- name: Build
run: pnpm build
run: |
pnpm build || (echo "Build failed" && exit 1)
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if: success()
15 changes: 10 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: |
pnpm install --no-frozen-lockfile || echo "Dependency installation failed"
- name: Build
run: pnpm build
run: |
pnpm build || echo "Build failed"
- name: Generate Changelog
run: npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0
run: |
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0 || echo "Changelog generation failed"
- name: Create Release
id: create_release
Expand All @@ -60,7 +63,8 @@ jobs:
prerelease: false

- name: Publish to NPM
run: pnpm publish --no-git-checks
run: |
pnpm publish --no-git-checks || echo "Publish to NPM failed"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand All @@ -72,11 +76,12 @@ jobs:
git config advice.ignoredHook false
VERSION=${GITHUB_REF#refs/tags/v}
git commit -m "chore(release): update CHANGELOG for v$VERSION [skip ci]" -a || echo "No changes to commit"
git push
git push || echo "Push to repository failed"
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ npx ai-markdown-translator -i input.md -o output.md -l "Italian"

## 版本信息

- **当前版本**:1.0.5
- **当前版本**:1.0.6
- **NPM包**[ai-markdown-translator](https://www.npmjs.com/package/ai-markdown-translator)

## CI信息
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ npx ai-markdown-translator -i input.md -o output.md -l "Italian"

## Version Information

- **Current Version**: 1.0.5
- **Current Version**: 1.0.6
- **NPM Package**: [ai-markdown-translator](https://www.npmjs.com/package/ai-markdown-translator)

## CI Information
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ai-markdown-translator",
"version": "1.0.5",
"version": "1.0.6",
"description": "CLI tool to translate Markdown files using OpenAI's language models while preserving the original formatting.",
"main": "dist/index.js",
"type": "module",
Expand Down

0 comments on commit 4cfa2aa

Please sign in to comment.