Skip to content

Commit aa9362f

Browse files
ci: enhance release workflow
- Add build artifacts upload with 30-day retention - Use timestamp-based versioning for automated releases - Switch to ncipollo/release-action for better release management - Add detailed build information in release notes - Add Chinese comments for better readability
1 parent 2cea9a6 commit aa9362f

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

.github/workflows/flutter-web.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,59 @@ jobs:
2525
- name: Build web
2626
run: flutter build web --release --base-href /json2dart/
2727

28+
# 上传构建产物作为 Artifacts
29+
- name: Upload Build Artifacts
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: web-build
33+
path: build/web/
34+
retention-days: 30
35+
36+
# 创建发布压缩包
2837
- name: Create Release Archive
2938
run: |
3039
cd build/web
3140
zip -r ../../json2dart-web.zip .
3241
cd ../..
3342
43+
# 获取时间戳作为版本号
44+
- name: Get current date
45+
id: date
46+
run: echo "BUILD_DATE=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
47+
48+
# 创建发布版本
3449
- name: Create Release
35-
uses: softprops/action-gh-release@v1
36-
if: startsWith(github.ref, 'refs/tags/')
50+
uses: ncipollo/release-action@v1
51+
if: github.ref == 'refs/heads/main'
3752
with:
38-
files: json2dart-web.zip
39-
name: Release ${{ github.ref_name }}
53+
artifacts: "json2dart-web.zip"
54+
token: ${{ secrets.GITHUB_TOKEN }}
55+
tag: build_${{ env.BUILD_DATE }}
56+
name: Build ${{ env.BUILD_DATE }}
4057
body: |
41-
JSON to Dart Converter Web Release
58+
JSON to Dart Converter Web Build
59+
60+
Build Date: ${{ env.BUILD_DATE }}
4261
43-
This release contains the compiled web application.
62+
This release contains:
63+
- Compiled web application
64+
- All build artifacts
4465
4566
## Installation
4667
1. Download the zip file
4768
2. Extract it to your web server
4869
3. Access through your web server
4970
5071
## Direct Usage
51-
You can also use the online version at: https://invincible1996.github.io/json2dart/
72+
Online version: https://invincible1996.github.io/json2dart/
73+
74+
## Changes
75+
This is an automated build from the main branch.
5276
77+
# 部署到 GitHub Pages
5378
- name: Deploy to GitHub Pages
5479
uses: peaceiris/actions-gh-pages@v3
5580
if: github.ref == 'refs/heads/main'
5681
with:
5782
github_token: ${{ secrets.GITHUB_TOKEN }}
58-
publish_dir: ./build/web
83+
publish_dir: ./build/web

0 commit comments

Comments
 (0)