optimise CI

This commit is contained in:
Jack Baron 2020-10-19 14:12:43 +01:00
parent ca87635473
commit addf3e858f
No known key found for this signature in database
GPG key ID: CD10BCEEC646C064

View file

@ -2,51 +2,33 @@ name: .NET Build
on: [push] on: [push]
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v1 - name: Checkout
# Set Path workaround for https://github.com/actions/virtual-environments/issues/263 uses: actions/checkout@v2
- name: "Temp step to Set Path for Windows" - name: Setup msbuild
run: | uses: microsoft/setup-msbuild@v1.0.2
echo "::add-path::C:\Program Files\Git\mingw64\bin" - name: Install dependencies
echo "::add-path::C:\Program Files\Git\usr\bin" run: msbuild -t:restore
echo "::add-path::C:\Program Files\Git\bin" - name: Build project
- name: Setup MSBuild run: msbuild ModAssistant/ModAssistant.csproj /t:Build /p:Configuration=Release
uses: warrenbuckley/Setup-MSBuild@v1 - name: Cleanup release
- name: Install dependencies shell: bash
run: msbuild -t:restore run: |
- name: Build project find "ModAssistant/bin/Release" -type f ! -name "ModAssistant.exe" -delete
run: msbuild ModAssistant/ModAssistant.csproj /t:Build /p:Configuration=Release cp "LICENSE" "ModAssistant/bin/Release/LICENSE.ModAssistant.txt"
- name: Cleanup release - name: Upload Build
shell: bash if: contains(github.ref, 'refs/tags/') == false
run: | uses: actions/upload-artifact@v1
find "ModAssistant/bin/Release" -type f ! -name "ModAssistant.exe" -delete with:
cp "LICENSE" "ModAssistant/bin/Release/LICENSE.ModAssistant.txt" name: ModAssistant-${{ github.sha }}
- name: Upload Build path: ./ModAssistant/bin/Release
if: contains(github.ref, 'refs/tags/') == false - name: Release
uses: actions/upload-artifact@v1 if: startsWith(github.ref, 'refs/tags/')
with: uses: softprops/action-gh-release@v1
name: ModAssistant-${{ github.sha }} env:
path: ./ModAssistant/bin/Release GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release with:
if: contains(github.ref, 'refs/tags/') == true name: Mod Assistant ${{ github.ref }}
id: create_release files: ./ModAssistant/bin/Release/ModAssistant.exe
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