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 #59 from kurmann/23-template-für-sci-modul-hinzufügen
Template für ein komplettes Service-Repository erstellt und mit den neusten Workflows versehen
- Loading branch information
Showing
25 changed files
with
1,161 additions
and
54 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
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
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"GitHub.copilot", | ||
"GitHub.vscode-github-actions", | ||
"ms-dotnettools.csdevkit" | ||
] | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
templates/services-repo/.github/release-drafter-config.yml
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Konfigurationsdatei für das Release-Drafter-Tool. | ||
# release-drafter-config.yml | ||
|
||
# Definiert die Vorlage für den Namen des Releases. | ||
name-template: 'v$RESOLVED_VERSION' # Automatisch erhöhte Versionsnummer | ||
|
||
# Definiert die Vorlage für den Namen des Release-Tags. | ||
tag-template: 'v$RESOLVED_VERSION' # Automatisch erhöhte Versionsnummer | ||
|
||
# Kategorien für das Changelog, identifiziert durch Labels auf Pull Requests. | ||
categories: | ||
- title: 'Features' | ||
labels: | ||
- 'enhancement' | ||
- title: 'Bug Fixes' | ||
labels: | ||
- 'bug' | ||
- title: 'Dokumentation' | ||
labels: | ||
- 'documentation' | ||
|
||
# Layout des Changelogs, formatiert nach den Änderungen in den Pull Requests. | ||
template: | | ||
## Änderungen | ||
$CHANGES | ||
# Version-Resolver bestimmt die Art der Versionserhöhung basierend auf den PR Labels. | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'breaking' | ||
minor: | ||
labels: | ||
- 'enhancement' | ||
patch: | ||
labels: | ||
- 'bug' | ||
- 'documentation' | ||
default: minor |
45 changes: 45 additions & 0 deletions
45
templates/services-repo/.github/workflows/draft_release.yml
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Draft Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: read | ||
|
||
jobs: | ||
build_and_test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CSPROJ_FILE: src/Services/Services.csproj | ||
DOTNET_VERSION: '8.0.x' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Install dependencies | ||
run: dotnet restore ${{ env.CSPROJ_FILE }} | ||
|
||
- name: Test | ||
run: dotnet test ${{ env.CSPROJ_FILE }} | ||
|
||
release_draft: | ||
runs-on: ubuntu-latest | ||
needs: build_and_test | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run Release Drafter | ||
uses: release-drafter/release-drafter@v6 | ||
with: | ||
config-name: 'release-drafter-config.yml' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
101 changes: 101 additions & 0 deletions
101
templates/services-repo/.github/workflows/publish_package.yml
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Publish NuGet Package on Release | ||
|
||
on: | ||
release: | ||
types: [published, prereleased] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: read | ||
|
||
env: | ||
CSPROJ_FILE: src/Services/Services.csproj | ||
DOTNET_VERSION: '8.0.x' | ||
|
||
jobs: | ||
get_release_or_prerelease: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get latest release or prerelease | ||
id: get_release_or_prerelease | ||
run: | | ||
RELEASES_JSON=$(gh release list --json tagName,name,isPrerelease --exclude-drafts) | ||
LATEST_RELEASE_OR_PRERELEASE_JSON=$(echo "$RELEASES_JSON" | jq -r '.[0]') | ||
RELEASE_TAG_NAME=$(echo "$LATEST_RELEASE_OR_PRERELEASE_JSON" | jq -r '.tagName') | ||
RELEASE_NAME=$(echo "$LATEST_RELEASE_OR_PRERELEASE_JSON" | jq -r '.name') | ||
RELEASE_IS_PRERELEASE=$(echo "$LATEST_RELEASE_OR_PRERELEASE_JSON" | jq -r '.isPrerelease') | ||
RELEASE_VERSION="${RELEASE_TAG_NAME#"v"}" | ||
REPO_URL="https://github.com/${GITHUB_REPOSITORY}" | ||
RELEASE_URL="${REPO_URL}/releases/tag/${RELEASE_TAG_NAME}" | ||
echo "release_version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | ||
echo "release_tag_name=$RELEASE_TAG_NAME" >> "$GITHUB_OUTPUT" | ||
echo "release_url=$RELEASE_URL" >> "$GITHUB_OUTPUT" | ||
echo "release_is_prerelease=$RELEASE_IS_PRERELEASE" >> "$GITHUB_OUTPUT" | ||
echo "Found latest $(if [ "$RELEASE_IS_PRERELEASE" = "true" ]; then echo "prerelease"; else echo "release"; fi): $RELEASE_TAG_NAME" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
outputs: | ||
release_version: ${{ steps.get_release_or_prerelease.outputs.release_version }} | ||
release_tag_name: ${{ steps.get_release_or_prerelease.outputs.release_tag_name }} | ||
release_url: ${{ steps.get_release_or_prerelease.outputs.release_url }} | ||
release_is_prerelease: ${{ steps.get_release_or_prerelease.outputs.release_is_prerelease }} | ||
|
||
build_and_publish: | ||
needs: get_release_or_prerelease | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore ${{ env.CSPROJ_FILE }} | ||
|
||
- name: Build | ||
run: dotnet build ${{ env.CSPROJ_FILE }} --no-restore --configuration Release | ||
|
||
- name: Pack | ||
run: | | ||
echo "Using version ${{ needs.get_release_or_prerelease.outputs.release_version }} from setup job." | ||
dotnet pack ${{ env.CSPROJ_FILE }} --no-build --configuration Release \ | ||
-p:PackageVersion=${{ needs.get_release_or_prerelease.outputs.release_version }} \ | ||
-p:PackageReleaseNotes=${{ needs.get_release_or_prerelease.outputs.release_url }} \ | ||
-p:PackageProjectUrl="https://github.com/${{ github.repository }}" \ | ||
-p:RepositoryUrl="https://github.com/${{ github.repository }}.git" \ | ||
-p:RepositoryType="git" \ | ||
--include-symbols -p:SymbolPackageFormat=snupkg \ | ||
-o nupkgs | ||
shell: bash | ||
|
||
- name: List output files | ||
run: | | ||
echo "Listing built packages in nupkgs directory:" | ||
ls nupkgs/ | ||
shell: bash | ||
|
||
- name: Push NuGet Package | ||
run: | | ||
cd nupkgs | ||
dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | ||
shell: pwsh | ||
|
||
- name: Push to GitHub Packages | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cd nupkgs | ||
dotnet nuget push "*.nupkg" --api-key $env:GITHUB_TOKEN --source "https://nuget.pkg.github.com/${{ github.repository_owner }}" --skip-duplicate | ||
shell: pwsh | ||
|
||
|
Oops, something went wrong.