diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc3a95e0b..c22fcf3f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,72 +4,84 @@ on: push: branches: - 'release/1.*' + pull_request: + branches: + - 'release/1.*' paths-ignore: - '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 repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - uses: actions/checkout@v2 - - name: Set up .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '5.x.x' + - name: Set up .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '5.x' - - name: Install Visual Studio Build Tools - run: | - choco install visualstudio2019buildtools --version=16.11.7 - choco install microsoft-build-tools --version=15.0.26320.2 + - name: Restore nuget packages and generate credential templates + run: dotnet restore src/Greenshot.sln --configfile nuget.config --source https://api.nuget.org/v3/index.json + 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 }} - - name: Install MSBuild Community Tasks - run: | - choco install msbuild.communitytasks + - name: Build and package + run: dotnet build src/Greenshot.sln --configuration Release --no-restore + 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 }} - - name: Verify MSBuild is available - run: | - echo "Checking MSBuild version" - if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe") { - &"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" -version - } else { - Write-Error "MSBuild.exe not found" - } + - name: Copy Files + run: | + mkdir -p ${{ github.workspace }}/artifacts + cp $(Build.SourcesDirectory)/installer/Greenshot-INSTALLER-*.exe ${{ github.workspace }}/artifacts/ + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: drop + path: ${{ github.workspace }}/artifacts - - name: Restore NuGet packages - run: nuget restore src/Greenshot.sln + deploy: + runs-on: windows-latest + needs: build - - name: Build and package - run: | - if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe") { - &"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" src/Greenshot.sln /p:Configuration=Release - } else { - Write-Error "MSBuild.exe not found" - } + steps: + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: drop - - name: Copy Files to artifact staging directory - run: | - mkdir -p ${{ github.workspace }}/artifacts - cp ${{ github.workspace }}/installer/Greenshot-INSTALLER-*.exe ${{ github.workspace }}/artifacts - - - name: Upload Build Artifacts - uses: actions/upload-artifact@v3 - with: - name: drop - path: ${{ github.workspace }}/artifacts \ No newline at end of file + - 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 diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 6b3c6bed5..f2ce406a1 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,40 +1,13 @@ - - $(PkgMSBuildTasks)\tools\ + + $(PkgMSBuildTasks)\tools\ - - - $(MSBuildExtensionsPath)\MSBuildCommunityTasks\ - - + - \ No newline at end of file diff --git a/src/Greenshot.sln b/src/Greenshot.sln index 91ddf4314..b71e79bd3 100644 --- a/src/Greenshot.sln +++ b/src/Greenshot.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34009.444 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}" ProjectSection(ProjectDependencies) = postProject @@ -48,6 +48,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\azure-pipelines.yml = ..\azure-pipelines.yml Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets + ..\.github\workflows\release.yml = ..\.github\workflows\release.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Editor", "Greenshot.Editor\Greenshot.Editor.csproj", "{148D3C8B-D6EC-4A7D-80E9-243A81F19DD2}"