-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (49 loc) · 2.17 KB
/
release.yml
File metadata and controls
57 lines (49 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Create Release
on:
push:
tags:
- 'v*' # Tags starting with 'v' will trigger this workflow
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch full history to support version calculation
- name: Get tag version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update version in gradle.properties
run: |
# Ensure we have the latest code
git fetch origin
git checkout main
# Update version number
sed -i "s/^version=.*/version=${{ steps.get_version.outputs.VERSION }}/" gradle.properties
# Commit and push changes
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Update version in README.md and README-CN.md
for file in README.md README-CN.md; do
if [ -f "$file" ]; then
sed -i "s/implementation(\"io.github.windedge.viform:viform-core:.*\")/implementation(\"io.github.windedge.viform:viform-core:${{ steps.get_version.outputs.VERSION }}\")/g" "$file"
sed -i "s/implementation(\"io.github.windedge.viform:viform-compose:.*\")/implementation(\"io.github.windedge.viform:viform-compose:${{ steps.get_version.outputs.VERSION }}\")/g" "$file"
fi
done
# Commit and push changes
git add README.md README-CN.md
git commit -m "Update version to ${{ steps.get_version.outputs.VERSION }}" -a || echo "No changes to commit"
git push origin HEAD:main
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.get_version.outputs.VERSION }}
body: |
Release version ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# files: | # Optional: Attach build artifacts to the release
# build/libs/*.jar