From addf3e858f6325fabe883d229ef68ca182d32b9c Mon Sep 17 00:00:00 2001 From: Jack Baron Date: Mon, 19 Oct 2020 14:12:43 +0100 Subject: [PATCH] optimise CI --- .github/workflows/dotnet.yml | 78 ++++++++++++++---------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c5c5328..7c7f6de 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,51 +2,33 @@ name: .NET Build on: [push] jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v1 - # Set Path workaround for https://github.com/actions/virtual-environments/issues/263 - - name: "Temp step to Set Path for Windows" - run: | - echo "::add-path::C:\Program Files\Git\mingw64\bin" - echo "::add-path::C:\Program Files\Git\usr\bin" - echo "::add-path::C:\Program Files\Git\bin" - - name: Setup MSBuild - uses: warrenbuckley/Setup-MSBuild@v1 - - name: Install dependencies - run: msbuild -t:restore - - name: Build project - run: msbuild ModAssistant/ModAssistant.csproj /t:Build /p:Configuration=Release - - name: Cleanup release - shell: bash - run: | - find "ModAssistant/bin/Release" -type f ! -name "ModAssistant.exe" -delete - cp "LICENSE" "ModAssistant/bin/Release/LICENSE.ModAssistant.txt" - - name: Upload Build - if: contains(github.ref, 'refs/tags/') == false - uses: actions/upload-artifact@v1 - with: - name: ModAssistant-${{ github.sha }} - path: ./ModAssistant/bin/Release - - name: Create Release - if: contains(github.ref, 'refs/tags/') == true - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Mod Assistant ${{ github.ref }} - draft: false - prerelease: false - - name: Upload Release Asset - if: contains(github.ref, 'refs/tags/') == true - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./ModAssistant/bin/Release/ModAssistant.exe - asset_name: ModAssistant.exe - asset_content_type: application/vnd.microsoft.portable-executable + build: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup msbuild + uses: microsoft/setup-msbuild@v1.0.2 + - name: Install dependencies + run: msbuild -t:restore + - name: Build project + run: msbuild ModAssistant/ModAssistant.csproj /t:Build /p:Configuration=Release + - name: Cleanup release + shell: bash + run: | + find "ModAssistant/bin/Release" -type f ! -name "ModAssistant.exe" -delete + cp "LICENSE" "ModAssistant/bin/Release/LICENSE.ModAssistant.txt" + - name: Upload Build + if: contains(github.ref, 'refs/tags/') == false + uses: actions/upload-artifact@v1 + with: + name: ModAssistant-${{ github.sha }} + path: ./ModAssistant/bin/Release + - name: Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: Mod Assistant ${{ github.ref }} + files: ./ModAssistant/bin/Release/ModAssistant.exe