Skip to content

Commit 61c1805

Browse files
committed
ci(github-actions): add workflow for publishing releases
- Introduced `publish.yml` GitHub Action to automate release builds and packaging. - Supports Windows, Linux, and macOS builds using .NET 9. - Automatically cleans version strings from tags and packages outputs with Velopack. - Uploads release assets as a draft with generated release notes.
1 parent bdb7c64 commit 61c1805

File tree

1 file changed

+96
-0
lines changed
  • EasyExtractUnitypackageRework/EasyExtractCrossPlatform/.github/workflows

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
- 'V*' # Für Uppercase Tags wie V2.0.8.1
8+
- '[0-9]*' # Für Tags ohne Prefix wie 2.0.7.5
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
build-and-release:
15+
name: Build for ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: windows-latest
22+
rid: win-x64
23+
- os: ubuntu-latest
24+
rid: linux-x64
25+
- os: macos-latest
26+
rid: osx-arm64
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Setup .NET 9
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: 9.0.x
36+
37+
- name: Install Velopack (vpk)
38+
run: dotnet tool install -g vpk
39+
40+
- name: Install Dependencies (Linux)
41+
if: runner.os == 'Linux'
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y libfuse2
45+
46+
- name: Clean Version String
47+
shell: bash
48+
run: |
49+
# Holt den Tag Name (z.B. "refs/tags/V2.0.8.1")
50+
TAG_NAME=${GITHUB_REF#refs/tags/}
51+
52+
# Entfernt führendes 'v' oder 'V' via Regex, falls vorhanden
53+
# V2.0.8.1 -> 2.0.8.1
54+
# v1.0.0 -> 1.0.0
55+
# 2.0.7.5 -> 2.0.7.5
56+
CLEAN_VERSION=$(echo "$TAG_NAME" | sed 's/^[vV]//')
57+
58+
echo "Processing Version: $CLEAN_VERSION"
59+
echo "VERSION=$CLEAN_VERSION" >> $GITHUB_ENV
60+
61+
- name: Publish DotNet
62+
run: |
63+
dotnet publish EasyExtractCrossPlatform.csproj \
64+
-c Release \
65+
-r ${{ matrix.rid }} \
66+
--self-contained \
67+
-p:Version=${{ env.VERSION }} \
68+
-o publish_output
69+
70+
# --- WINDOWS PACKING (mit .exe) ---
71+
- name: Pack with Velopack (Windows)
72+
if: runner.os == 'Windows'
73+
run: |
74+
vpk pack -u EasyExtractCrossPlatform -v ${{ env.VERSION }} -p publish_output -o release_output --mainExe EasyExtractCrossPlatform.exe
75+
76+
# --- LINUX PACKING (ohne .exe) ---
77+
- name: Pack with Velopack (Linux)
78+
if: runner.os == 'Linux'
79+
run: |
80+
vpk pack -u EasyExtractCrossPlatform -v ${{ env.VERSION }} -p publish_output -o release_output --mainExe EasyExtractCrossPlatform
81+
82+
# --- MAC PACKING (ohne .exe) ---
83+
- name: Pack with Velopack (macOS)
84+
if: runner.os == 'macOS'
85+
run: |
86+
vpk pack -u EasyExtractCrossPlatform -v ${{ env.VERSION }} -p publish_output -o release_output --mainExe EasyExtractCrossPlatform
87+
88+
- name: Upload Release Assets
89+
uses: softprops/action-gh-release@v1
90+
if: startsWith(github.ref, 'refs/tags/')
91+
with:
92+
files: release_output/*
93+
draft: true # Erstellt Release als Entwurf (User sehen es noch nicht)
94+
generate_release_notes: true # Generiert automatisch Changelog aus Commits
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)