|
5 | 5 | branches: [ "main" ] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - build-and-release: |
| 8 | + build: |
9 | 9 | runs-on: windows-latest |
10 | 10 |
|
11 | 11 | env: |
12 | 12 | Project_Path: CS2Cheat.csproj |
13 | 13 | Output_Dir: publish |
14 | 14 |
|
15 | 15 | steps: |
16 | | - - name: Checkout repository |
| 16 | + - name: Checkout code |
17 | 17 | uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
18 | 20 |
|
19 | | - - name: Setup .NET SDK |
| 21 | + - name: Setup .NET |
20 | 22 | uses: actions/setup-dotnet@v4 |
21 | 23 | with: |
22 | 24 | dotnet-version: 8.0.x |
23 | 25 |
|
24 | 26 | - name: Build and publish project |
25 | 27 | 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 ` |
27 | 31 | /p:PublishSingleFile=true ` |
28 | 32 | /p:IncludeNativeLibrariesForSelfExtract=true ` |
29 | 33 | /p:IncludeAllContentForSelfExtract=true ` |
30 | | - /p:DeleteExistingFiles=true ` |
31 | | - --self-contained false |
| 34 | + /p:DeleteExistingFiles=true |
32 | 35 | env: |
33 | 36 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
34 | 37 |
|
| 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 | + |
35 | 44 | - name: Get latest tag |
36 | 45 | id: get_latest_tag |
| 46 | + shell: bash |
37 | 47 | 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) |
39 | 49 | echo "Latest tag: $tag" |
40 | 50 | echo "tag=$tag" >> $GITHUB_OUTPUT |
41 | 51 |
|
42 | 52 | - name: Calculate new tag |
43 | 53 | id: calculate_tag |
| 54 | + shell: bash |
44 | 55 | run: | |
45 | 56 | 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"} |
50 | 58 | IFS='.' read -r major minor patch <<< "$base_version" |
51 | 59 | patch=$((patch + 1)) |
52 | 60 | new_tag="${major}.${minor}.${patch}-autobuild" |
53 | 61 | echo "New tag: $new_tag" |
54 | 62 | echo "tag=$new_tag" >> $GITHUB_OUTPUT |
55 | 63 |
|
56 | 64 | - name: Create Git tag |
| 65 | + shell: bash |
57 | 66 | run: | |
58 | 67 | git config user.name "github-actions" |
59 | 68 | git config user.email "[email protected]" |
60 | 69 | git tag ${{ steps.calculate_tag.outputs.tag }} |
61 | 70 | 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: . |
62 | 79 |
|
63 | 80 | - name: Create GitHub Release |
64 | 81 | uses: softprops/action-gh-release@v2 |
65 | 82 | with: |
66 | 83 | tag_name: ${{ steps.calculate_tag.outputs.tag }} |
67 | 84 | name: Release ${{ steps.calculate_tag.outputs.tag }} |
68 | | - files: ${{ env.Output_Dir }}/*.exe |
| 85 | + body: "Автоматическая сборка и релиз" |
| 86 | + files: ./*.exe |
69 | 87 | env: |
70 | 88 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments