Skip to content

[R0009] Multi-Monitor-Sichtblockade implementieren #2

[R0009] Multi-Monitor-Sichtblockade implementieren

[R0009] Multi-Monitor-Sichtblockade implementieren #2

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: false
default: "patch"
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
env:
DOTNET_VERSION: "9.x.x"
SOLUTION_DIR: "VisualPairCoding"
PROJECT: "./VisualPairCoding.AvaloniaUI/VisualPairCoding.AvaloniaUI.csproj"
jobs:
prepare:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Calculate next version
id: version
run: |
# Determine bump type
BUMP="${{ github.event.inputs.bump || 'patch' }}"
echo "Bump type: $BUMP"
# Find latest semver tag (supports v1.78 as v1.78.0)
LATEST_TAG=$(git tag --list 'v[0-9]*' --sort=-version:refname | head -n1)
echo "Latest tag: $LATEST_TAG"
if [ -z "$LATEST_TAG" ]; then
MAJOR=1; MINOR=0; PATCH=0
else
# Strip 'v' prefix
VERSION="${LATEST_TAG#v}"
# Handle two-part versions (v1.78 -> 1.78.0)
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
PATCH="${PATCH:-0}"
fi
echo "Current: $MAJOR.$MINOR.$PATCH"
case "$BUMP" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
esac
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
NEW_TAG="v$NEW_VERSION"
echo "Next version: $NEW_VERSION (tag: $NEW_TAG)"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "tag=$NEW_TAG" >> $GITHUB_OUTPUT
build-and-release:
name: Build ${{ matrix.OUTPUTDIR }}
needs: prepare
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
RUNTIMEID: win-x64
OUTPUTDIR: VisualPairCoding-win-x64
- os: ubuntu-latest
RUNTIMEID: linux-x64
OUTPUTDIR: VisualPairCoding-linux-x64
- os: macos-latest
RUNTIMEID: osx-x64
OUTPUTDIR: VisualPairCoding-osx-x64
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Install dependencies
run: dotnet restore
working-directory: Source/${{ env.SOLUTION_DIR }}
- name: Set version number
run: ./Set-Version-Number.ps1 "${{ needs.prepare.outputs.tag }}"
working-directory: Scripts
shell: pwsh
- name: Build
run: dotnet build --configuration Release --no-restore
working-directory: Source/${{ env.SOLUTION_DIR }}
- name: Test
run: dotnet test --no-build --configuration Release
working-directory: Source/${{ env.SOLUTION_DIR }}
- name: Publish
run: >
dotnet publish ${{ env.PROJECT }}
-c Release
-o ${{ matrix.OUTPUTDIR }}
-p:PublishReadyToRun=true
--self-contained true
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-p:UseAppHost=true
-r ${{ matrix.RUNTIMEID }}
working-directory: Source/${{ env.SOLUTION_DIR }}
- uses: vimtor/action-zip@v1
with:
files: ./Source/${{ env.SOLUTION_DIR }}/${{ matrix.OUTPUTDIR }}/
dest: ${{ matrix.OUTPUTDIR }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.OUTPUTDIR }}
path: ${{ matrix.OUTPUTDIR }}.zip
create-release:
name: Create Release
needs: [prepare, build-and-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create tag and release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${{ needs.prepare.outputs.tag }}"
VERSION="${{ needs.prepare.outputs.version }}"
# Create tag
git tag "$TAG"
git push origin "$TAG"
# Collect all zip files
find artifacts -name '*.zip' -exec mv {} . \;
# Create release
gh release create "$TAG" \
--title "VisualPairCoding $VERSION" \
--generate-notes \
*.zip