diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ea35f6e9..5267348b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,50 +1,65 @@ -name: .NET Desktop CI/CD +name: Build and Deploy on: push: branches: - 'release/1.*' paths-ignore: - - 'develop' + - 'develop/**' jobs: build: runs-on: windows-latest - + env: + Box13_ClientId: ${{ secrets.Box13_ClientId }} + Box13_ClientSecret: ${{ secrets.Box13_ClientSecret }} + DropBox13_ClientId: ${{ secrets.DropBox13_ClientId }} + DropBox13_ClientSecret: ${{ secrets.DropBox13_ClientSecret }} + Flickr_ClientId: ${{ secrets.Flickr_ClientId }} + Flickr_ClientSecret: ${{ secrets.Flickr_ClientSecret }} + Imgur13_ClientId: ${{ secrets.Imgur13_ClientId }} + Imgur13_ClientSecret: ${{ secrets.Imgur13_ClientSecret }} + Photobucket_ClientId: ${{ secrets.Photobucket_ClientId }} + Photobucket_ClientSecret: ${{ secrets.Photobucket_ClientSecret }} + Picasa_ClientId: ${{ secrets.Picasa_ClientId }} + Picasa_ClientSecret: ${{ secrets.Picasa_ClientSecret }} steps: - - name: Checkout code - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '5.0.100' + - name: Restore nuget packages and generate credential templates + run: dotnet msbuild src/Greenshot.sln /restore /t:PrepareForBuild /p:Configuration=Release /p:Platform="Any CPU" + - name: Build and package + run: dotnet msbuild src/Greenshot.sln /p:Configuration=Release /p:Platform="Any CPU" + - name: Copy Files to artifact staging directory + run: | + mkdir -p ${{ github.workspace }}/artifacts + cp $(Build.SourcesDirectory)/installer/Greenshot-INSTALLER-*.exe ${{ github.workspace }}/artifacts + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: drop + path: ${{ github.workspace }}/artifacts - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '5.0.100' # Setze die gewünschte .NET-Version - - - name: Restore NuGet packages - run: dotnet restore src/Greenshot.sln - - - name: Publish single-exe x64 - run: dotnet publish src/Greenshot/Greenshot.csproj -f net5.0-windows -c Release /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:RuntimeIdentifier=win-x64 - - - name: Rename single-exe x64 - run: | - Rename-Item "$(Build.SourcesDirectory)\src\Greenshot\bin\Release\net5.0-windows\win-x64\publish\Greenshot.exe" "Greenshot-x64.exe" - - - name: Publish single-exe x86 - run: dotnet publish src/Greenshot/Greenshot.csproj -f net5.0-windows -c Release /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:RuntimeIdentifier=win-x86 - - - name: Rename single-exe x86 - run: | - Rename-Item "$(Build.SourcesDirectory)\src\Greenshot\bin\Release\net5.0-windows\win-x86\publish\Greenshot.exe" "Greenshot-x86.exe" - - - name: Copy Files to Artifact Staging Directory - run: | - mkdir -p ${{ github.workspace }}/drop - 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 - uses: actions/upload-artifact@v4 - with: - name: drop - path: ${{ github.workspace }}/drop/*.exe + deploy: + runs-on: windows-latest + needs: build + steps: + - name: Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: drop + path: ${{ github.workspace }}/drop + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ github.run_number }} + release_name: "Greenshot ${{ github.run_number }} unstable" + draft: true + prerelease: true + files: ${{ github.workspace }}/drop/*.exe \ No newline at end of file