Update release.yml
This commit is contained in:
37
.github/workflows/release.yml
vendored
37
.github/workflows/release.yml
vendored
@@ -14,43 +14,30 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Git
|
- name: Set up Git
|
||||||
run: |
|
run: git fetch --tags
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
- name: Get next version
|
- name: Read version from script
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
latest_tag=$(git tag --list "v*" | sort -V | tail -n1)
|
version_line=$(grep -E "^version=" build.sh | head -n1)
|
||||||
if [ -z "$latest_tag" ]; then
|
version_value=$(echo "$version_line" | sed -E "s/.*'(v[0-9]+\.[0-9]+\.[0-9]+).*/\1/")
|
||||||
next_tag="v2.0"
|
if [ -z "$version_value" ]; then
|
||||||
else
|
echo "❌ 无法从脚本中读取版本号"
|
||||||
base=${latest_tag#v}
|
exit 1
|
||||||
major=$(echo $base | cut -d. -f1)
|
|
||||||
minor=$(echo $base | cut -d. -f2)
|
|
||||||
|
|
||||||
if [ "$minor" -eq 20 ]; then
|
|
||||||
next_major=$((major + 1))
|
|
||||||
next_minor=0
|
|
||||||
else
|
|
||||||
|
|
||||||
next_major=$major
|
|
||||||
next_minor=$((minor + 1))
|
|
||||||
fi
|
fi
|
||||||
|
echo "VERSION=$version_value" >> $GITHUB_ENV
|
||||||
next_tag="v${next_major}.${next_minor}"
|
echo "📦 读取到版本号: $version_value"
|
||||||
fi
|
|
||||||
echo "next_tag=$next_tag" >> $GITHUB_ENV
|
|
||||||
echo "Next version: $next_tag"
|
|
||||||
|
|
||||||
- name: Create archive
|
- name: Create archive
|
||||||
run: |
|
run: |
|
||||||
git archive --format=tar.gz -o QuickWrt.tar.gz HEAD
|
git archive --format=tar.gz -o QuickWrt.tar.gz HEAD
|
||||||
|
echo "✅ 打包完成: QuickWrt.tar.gz"
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ env.next_tag }}
|
tag_name: ${{ env.VERSION }}
|
||||||
name: ${{ env.next_tag }}
|
name: ${{ env.VERSION }}
|
||||||
files: QuickWrt.tar.gz
|
files: QuickWrt.tar.gz
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user