This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from kurmann/main
merge from main
- Loading branch information
Showing
3 changed files
with
102 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,54 @@ | ||
name: Pack .NET Template | ||
|
||
# Versionierungsstrategie: | ||
# Für den main-Branch werden Releases mit der in der .csproj-Datei festgelegten Version erstellt, | ||
# die manuell vor dem Merge angepasst werden sollte. Dies ermöglicht eine präzise Kontrolle über Major und Minor Releases. | ||
# Für alle anderen Branches werden automatische Zwischenreleases mit einem Datumssuffix generiert, um kontinuierliches Testing und Feedback | ||
# für Entwicklungsstände zu ermöglichen. Das Datumssuffix wird basierend auf dem aktuellen Datum und der Uhrzeit zum Zeitpunkt des Builds hinzugefügt, | ||
# was jede Version einzigartig macht. | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- '**' | ||
|
||
jobs: | ||
pack: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PROJECT_FILE: Templates.csproj | ||
BASE_VERSION: '1.0.0' # Wird dynamisch überschrieben | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: '8.0.x' | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Restore NuGet packages | ||
run: dotnet restore | ||
- name: Restore NuGet packages | ||
run: dotnet restore ${{ env.PROJECT_FILE }} | ||
|
||
- name: Pack .NET Template Project | ||
run: dotnet pack --configuration Release --no-build --output nupkg | ||
# Schritt: Lese die PackageVersion aus der .csproj Datei und setze sie als Umgebungsvariable | ||
- name: Read Package Version from .csproj and Set as Env Var | ||
run: | | ||
version=$(grep '<PackageVersion>' ${{ env.PROJECT_FILE }} | sed -n -e 's/.*<PackageVersion>\(.*\)<\/PackageVersion>.*/\1/p') | ||
echo "Base version is $version" | ||
echo "BASE_VERSION=$version" >> $GITHUB_ENV | ||
- name: Publish to NuGet.org | ||
run: dotnet nuget push "nupkg/*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json | ||
# Schritt: Pack .NET Template Project mit dynamischer Versionierung für Zwischenreleases | ||
- name: Pack .NET Template Project | ||
run: | | ||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
dotnet pack ${{ env.PROJECT_FILE }} --configuration Release --output nupkg | ||
else | ||
datetimeSuffix=$(date +"%Y%m%d%H%M") | ||
version="${{ env.BASE_VERSION }}-preview.$datetimeSuffix" | ||
dotnet pack ${{ env.PROJECT_FILE }} /p:PackageVersion=$version --configuration Release --output nupkg | ||
echo "Zwischenversion ist $version" | ||
fi | ||
- name: Publish to NuGet.org | ||
run: dotnet nuget push "nupkg/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters