Skip to content

Commit dbee426

Browse files
authored
Update dotnet-desktop.yml
1 parent bf1f3ba commit dbee426

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

.github/workflows/dotnet-desktop.yml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,84 @@ on:
55
branches: [ "main" ]
66

77
jobs:
8-
build-and-release:
8+
build:
99
runs-on: windows-latest
1010

1111
env:
1212
Project_Path: CS2Cheat.csproj
1313
Output_Dir: publish
1414

1515
steps:
16-
- name: Checkout repository
16+
- name: Checkout code
1717
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1820

19-
- name: Setup .NET SDK
21+
- name: Setup .NET
2022
uses: actions/setup-dotnet@v4
2123
with:
2224
dotnet-version: 8.0.x
2325

2426
- name: Build and publish project
2527
run: |
26-
dotnet publish $env:Project_Path -c Release -o $env:Output_Dir -r win-x64 `
28+
dotnet publish $env:Project_Path -c Release -r win-x64 `
29+
--self-contained false `
30+
-o $env:Output_Dir `
2731
/p:PublishSingleFile=true `
2832
/p:IncludeNativeLibrariesForSelfExtract=true `
2933
/p:IncludeAllContentForSelfExtract=true `
30-
/p:DeleteExistingFiles=true `
31-
--self-contained false
34+
/p:DeleteExistingFiles=true
3235
env:
3336
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
3437

38+
- name: Upload only .exe file
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: Built-Executable
42+
path: ${{ env.Output_Dir }}/*.exe
43+
3544
- name: Get latest tag
3645
id: get_latest_tag
46+
shell: bash
3747
run: |
38-
tag=$(git tag --sort=-v:refname | head -n 1)
48+
tag=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | tail -n 1)
3949
echo "Latest tag: $tag"
4050
echo "tag=$tag" >> $GITHUB_OUTPUT
4151
4252
- name: Calculate new tag
4353
id: calculate_tag
54+
shell: bash
4455
run: |
4556
latest="${{ steps.get_latest_tag.outputs.tag }}"
46-
base_version=$(echo "$latest" | grep -oP '\d+\.\d+\.\d+' | head -1)
47-
if [[ -z "$base_version" ]]; then
48-
base_version="0.0.0"
49-
fi
57+
base_version=${latest:-"0.0.0"}
5058
IFS='.' read -r major minor patch <<< "$base_version"
5159
patch=$((patch + 1))
5260
new_tag="${major}.${minor}.${patch}-autobuild"
5361
echo "New tag: $new_tag"
5462
echo "tag=$new_tag" >> $GITHUB_OUTPUT
5563
5664
- name: Create Git tag
65+
shell: bash
5766
run: |
5867
git config user.name "github-actions"
5968
git config user.email "[email protected]"
6069
git tag ${{ steps.calculate_tag.outputs.tag }}
6170
git push origin ${{ steps.calculate_tag.outputs.tag }}
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Download executable
75+
uses: actions/download-artifact@v4
76+
with:
77+
name: Built-Executable
78+
path: .
6279

6380
- name: Create GitHub Release
6481
uses: softprops/action-gh-release@v2
6582
with:
6683
tag_name: ${{ steps.calculate_tag.outputs.tag }}
6784
name: Release ${{ steps.calculate_tag.outputs.tag }}
68-
files: ${{ env.Output_Dir }}/*.exe
85+
body: "Автоматическая сборка и релиз"
86+
files: ./*.exe
6987
env:
7088
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)