Skip to content

Commit 580b6b0

Browse files
committed
indo
0 parents  commit 580b6b0

File tree

7 files changed

+1240
-0
lines changed

7 files changed

+1240
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- publish
7+
8+
permissions:
9+
contents: write
10+
pull-requests: read
11+
12+
jobs:
13+
build-and-release:
14+
runs-on: windows-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: '8.0.x'
27+
28+
- name: Restore dependencies
29+
run: dotnet restore
30+
31+
- name: Build win-x86 self-contained
32+
run: |
33+
dotnet publish -c Release -r win-x86 --self-contained true -p:PublishSingleFile=false -o ./publish/win-x86-self-contained
34+
35+
- name: Build win-x64 self-contained
36+
run: |
37+
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=false -o ./publish/win-x64-self-contained
38+
39+
- name: Build win-x86 framework-dependent
40+
run: |
41+
dotnet publish -c Release -r win-x86 --self-contained false -o ./publish/win-x86-framework-dependent
42+
43+
- name: Build win-x64 framework-dependent
44+
run: |
45+
dotnet publish -c Release -r win-x64 --self-contained false -o ./publish/win-x64-framework-dependent
46+
47+
- name: Create artifacts directory
48+
shell: pwsh
49+
run: |
50+
New-Item -ItemType Directory -Force -Path ./artifacts | Out-Null
51+
52+
- name: Create ZIP archives
53+
shell: pwsh
54+
run: |
55+
# Create ZIP files preserving directory structure
56+
$compressParams = @{
57+
Path = './publish/win-x86-self-contained'
58+
DestinationPath = './artifacts/win-x86-self-contained.zip'
59+
CompressionLevel = 'Optimal'
60+
Force = $true
61+
}
62+
Compress-Archive @compressParams
63+
64+
$compressParams.DestinationPath = './artifacts/win-x64-self-contained.zip'
65+
$compressParams.Path = './publish/win-x64-self-contained'
66+
Compress-Archive @compressParams
67+
68+
$compressParams.DestinationPath = './artifacts/win-x86-framework-dependent.zip'
69+
$compressParams.Path = './publish/win-x86-framework-dependent'
70+
Compress-Archive @compressParams
71+
72+
$compressParams.DestinationPath = './artifacts/win-x64-framework-dependent.zip'
73+
$compressParams.Path = './publish/win-x64-framework-dependent'
74+
Compress-Archive @compressParams
75+
76+
- name: Get version from project
77+
id: get_version
78+
shell: pwsh
79+
run: |
80+
# Extract version from .csproj file
81+
$csprojContent = Get-Content -Path "Ntk.Tools.AutoType.csproj" -Raw
82+
$versionMatch = [regex]::Match($csprojContent, '<Version>(.*?)</Version>')
83+
if ($versionMatch.Success) {
84+
$projectVersion = $versionMatch.Groups[1].Value
85+
} else {
86+
$projectVersion = "1.0.0"
87+
}
88+
89+
# Create version tag with commit hash
90+
$commitSha = "${{ github.sha }}".Substring(0, 7)
91+
$versionTag = "$projectVersion-$commitSha"
92+
echo "VERSION=$versionTag" >> $env:GITHUB_ENV
93+
echo "version=$versionTag" >> $env:GITHUB_OUTPUT
94+
echo "PROJECT_VERSION=$projectVersion" >> $env:GITHUB_ENV
95+
96+
- name: Create Release
97+
uses: softprops/action-gh-release@v1
98+
with:
99+
tag_name: v${{ steps.get_version.outputs.version }}
100+
name: Release v${{ steps.get_version.outputs.version }}
101+
body: |
102+
## نسخه ${{ steps.get_version.outputs.version }}
103+
104+
این نسخه شامل 4 نسخه مختلف برای دانلود است:
105+
106+
- **win-x86 self-contained**: نسخه مستقل برای Windows x86 (نیاز به نصب .NET ندارد)
107+
108+
- **win-x64 self-contained**: نسخه مستقل برای Windows x64 (نیاز به نصب .NET ندارد)
109+
110+
- **win-x86 framework-dependent**: نسخه وابسته به .NET Framework برای Windows x86
111+
112+
- **win-x64 framework-dependent**: نسخه وابسته به .NET Framework برای Windows x64
113+
114+
### تغییرات
115+
116+
- Commit: ${{ github.sha }}
117+
118+
- Branch: ${{ github.ref_name }}
119+
120+
- تاریخ: ${{ github.event.head_commit.timestamp }}
121+
files: |
122+
./artifacts/win-x86-self-contained.zip
123+
./artifacts/win-x64-self-contained.zip
124+
./artifacts/win-x86-framework-dependent.zip
125+
./artifacts/win-x64-framework-dependent.zip
126+
draft: false
127+
prerelease: false
128+
generate_release_notes: false
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+

0 commit comments

Comments
 (0)