-
Notifications
You must be signed in to change notification settings - Fork 31
102 lines (85 loc) · 3.29 KB
/
Copy pathRelease.yml
File metadata and controls
102 lines (85 loc) · 3.29 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: macutil Release
on:
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
macutil_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Cache .NET packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore MacUtilGUI/MacUtilGUI.fsproj
- name: Build and publish macOS x64
run: |
dotnet publish MacUtilGUI/MacUtilGUI.fsproj \
--configuration Release \
--runtime osx-x64 \
--self-contained true \
--output ./build/osx-x64 \
/p:PublishSingleFile=true \
/p:IncludeNativeLibrariesForSelfExtract=true
- name: Build and publish macOS ARM64
run: |
dotnet publish MacUtilGUI/MacUtilGUI.fsproj \
--configuration Release \
--runtime osx-arm64 \
--self-contained true \
--output ./build/osx-arm64 \
/p:PublishSingleFile=true \
/p:IncludeNativeLibrariesForSelfExtract=true
- name: Rename binaries
run: |
mv ./build/osx-x64/MacUtilGUI ./build/osx-x64/macutil-macos-x64
mv ./build/osx-arm64/MacUtilGUI ./build/osx-arm64/macutil-macos-arm64
- name: Extract Version
id: extract_version
run: |
# Fetch all tags
git fetch --tags
# Get the latest tag, default to 0.0.0 if no tags exist
latest_tag=$(git tag --sort=-version:refname | head -n1)
if [ -z "$latest_tag" ]; then
latest_tag="0.0.0"
fi
# Parse the latest tag (assuming format X.Y.Z)
IFS='.' read -ra VERSION_PARTS <<< "$latest_tag"
major=${VERSION_PARTS[0]:-0}
minor=${VERSION_PARTS[1]:-0}
patch=${VERSION_PARTS[2]:-0}
# Increment minor version by 0.1 (increment minor, reset patch to 0)
new_minor=$((minor + 1))
version="${major}.${new_minor}.0"
echo "Previous version: $latest_tag"
echo "New version: $version"
echo "version=$version" >> $GITHUB_ENV
shell: bash
- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.version }}
name: Pre-Release ${{ env.version }}
body: |


append_body: true
generate_release_notes: true
files: |
./build/osx-x64/macutil-macos-x64
./build/osx-arm64/macutil-macos-arm64
prerelease: true
env:
version: ${{ env.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}