Update GH Workflow

This commit is contained in:
jklingen 2025-01-03 16:52:27 +01:00
commit bbcbf1cb62

View file

@ -3,9 +3,9 @@ name: .NET Desktop CI/CD
on: on:
push: push:
branches: branches:
- 'release/1.*'
paths-ignore:
- 'develop' - 'develop'
paths-ignore:
- 'release/1*'
jobs: jobs:
build: build:
@ -18,54 +18,33 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: '6.0.x' # Setze die gewünschte .NET-Version dotnet-version: '5.0.100' # Setze die gewünschte .NET-Version
- name: Restore nuget packages and generate credential templates - name: Restore NuGet packages
run: dotnet msbuild src/Greenshot.sln /restore /t:PrepareForBuild run: dotnet restore src/Greenshot-Full.sln
- name: Build and package - name: Publish single-exe x64
run: dotnet msbuild src/Greenshot.sln /p:Configuration=Release run: dotnet publish src/Greenshot/Greenshot.csproj -f net5.0-windows -c Release /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:RuntimeIdentifier=win-x64
env:
Box13_ClientId: ${{ secrets.Box13_ClientId }} - name: Rename single-exe x64
Box13_ClientSecret: ${{ secrets.Box13_ClientSecret }} run: |
DropBox13_ClientId: ${{ secrets.DropBox13_ClientId }} Rename-Item "$(Build.SourcesDirectory)\src\Greenshot\bin\Release\net5.0-windows\win-x64\publish\Greenshot.exe" "Greenshot-x64.exe"
DropBox13_ClientSecret: ${{ secrets.DropBox13_ClientSecret }}
Flickr_ClientId: ${{ secrets.Flickr_ClientId }} - name: Publish single-exe x86
Flickr_ClientSecret: ${{ secrets.Flickr_ClientSecret }} run: dotnet publish src/Greenshot/Greenshot.csproj -f net5.0-windows -c Release /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:RuntimeIdentifier=win-x86
Imgur13_ClientId: ${{ secrets.Imgur13_ClientId }}
Imgur13_ClientSecret: ${{ secrets.Imgur13_ClientSecret }} - name: Rename single-exe x86
Photobucket_ClientId: ${{ secrets.Photobucket_ClientId }} run: |
Photobucket_ClientSecret: ${{ secrets.Photobucket_ClientSecret }} Rename-Item "$(Build.SourcesDirectory)\src\Greenshot\bin\Release\net5.0-windows\win-x86\publish\Greenshot.exe" "Greenshot-x86.exe"
Picasa_ClientId: ${{ secrets.Picasa_ClientId }}
Picasa_ClientSecret: ${{ secrets.Picasa_ClientSecret }}
- name: Copy Files to Artifact Staging Directory - name: Copy Files to Artifact Staging Directory
run: | run: |
mkdir -p ${{ github.workspace }}/drop mkdir -p ${{ github.workspace }}/drop
Copy-Item -Path "$(Build.SourcesDirectory)\installer\Greenshot-INSTALLER-*.exe" -Destination "${{ github.workspace }}/drop" -Force Copy-Item -Path "$(Build.SourcesDirectory)\src\Greenshot\bin\Release\net5.0-windows\win-x64\publish\Greenshot-x64.exe" -Destination "${{ github.workspace }}/drop" -Force
Copy-Item -Path "$(Build.SourcesDirectory)\src\Greenshot\bin\Release\net5.0-windows\win-x86\publish\Greenshot-x86.exe" -Destination "${{ github.workspace }}/drop" -Force
- name: Publish Artifact - name: Publish Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: drop name: drop
path: ${{ github.workspace }}/drop/*.exe path: ${{ github.workspace }}/drop/*.exe
deploy:
runs-on: windows-latest
needs: build
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: drop
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.run_number }}
release_name: Greenshot ${{ github.run_number }} unstable
draft: true
prerelease: true
files: ${{ github.workspace }}/drop/*.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}