-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 2.77 KB
/
release.yml
File metadata and controls
96 lines (83 loc) · 2.77 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
name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
# 1. JOB: Baue alle Binaries parallel
build:
strategy:
matrix:
include:
- os: windows-latest
rid: win-x64
executable: SourceToAI.exe
- os: ubuntu-latest
rid: linux-x64
executable: SourceToAI
- os: macos-latest
rid: osx-x64
executable: SourceToAI-intel
- os: macos-latest
rid: osx-arm64
executable: SourceToAI-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish Single File
run: >
dotnet publish SourceToAI.CLI/SourceToAI.CLI.csproj
-c Release
-r ${{ matrix.rid }}
--self-contained true
-p:PublishSingleFile=true
-p:PublishTrimmed=false
-o ./publish
- name: Rename and Prepare
shell: pwsh
run: |
$publishedExecutable = Get-ChildItem -Path "./publish" -File | Where-Object { $_.Name -match "SourceToAI" -and $_.Extension -notmatch "json|pdb" }
$newName = "${{ matrix.executable }}"
if ($publishedExecutable) {
Rename-Item -Path $publishedExecutable.FullName -NewName $newName
} else {
Write-Error "Keine ausführbare Datei gefunden!"
exit 1
}
if (Test-Path "SourceToAI.CLI/appsettings.json") {
Copy-Item "SourceToAI.CLI/appsettings.json" "./publish/appsettings.json"
}
- name: Upload Artifacts to Action
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.rid }}
# Lade hier nur die umbenannte Datei hoch. appsettings nur beim Windows-Job.
path: |
./publish/${{ matrix.executable }}
${{ matrix.os == 'windows-latest' && './publish/appsettings.json' || '' }}
retention-days: 1 # Brauchen wir nur kurz für den nächsten Job
# 2. JOB: Erstelle das GitHub Release (Läuft nur EINMAL, wenn Build fertig ist)
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all Artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
path: ./release-files
merge-multiple: true # Legt alle Dateien (exe, mac, linux, json) in denselben Ordner
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./release-files/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}