Skip to content

Commit

Permalink
Added updated build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
justalemon committed Jun 24, 2022
1 parent c224d67 commit b4fa646
Showing 1 changed file with 49 additions and 9 deletions.
58 changes: 49 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,71 @@
name: Compile Mod
on:
- push
- pull_request
release:
types:
- created
push:
pull_request:

jobs:
lint-and-compile:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-2022
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add msbuild
uses: microsoft/setup-msbuild@v1.1
- name: Setup .NET
uses: actions/setup-dotnet@v2.1.0
with:
dotnet-version: "6.0.x"
- name: Restore NuGet Packages
run: nuget restore ${{ github.event.repository.name }}.sln
run: dotnet restore ${{ github.event.repository.name }}.sln
- name: Patch csproj version
uses: justalemon/VersionPatcher@ff473034af090907184812b731fc3bc1a272b308
uses: justalemon/VersionPatcher@v0.4
with:
version: 1.7.0.${{ github.run_number }}
version: 1.2.2.${{ github.run_number }}
use-tag: true
csproj-files: "**/**.csproj"
- name: Compile
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: msbuild -m -p:Configuration=${{ matrix.configuration }} ${{ github.event.repository.name }}.sln
run: dotnet build ${{ github.event.repository.name }}.sln -c ${{ matrix.configuration }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}.${{ matrix.configuration }}
path: bin/${{ matrix.configuration }}
deploy:
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'release' }}
needs:
- lint-and-compile
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2.1.0
with:
dotnet-version: "6.0.x"
- name: Download the Artifact
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}.Release
path: bin/Release
- name: List Everything
run: ls -R
working-directory: bin/Release
- name: Repackage Files
run: 7z a ${{ github.event.repository.name }}.zip ${{ github.workspace }}/bin/Release/*
- name: Deploy NuGet
run: dotnet nuget push "**/*.nupkg" -s 'https://api.nuget.org/v3/index.json' -k ${{secrets.NUGET}}
- name: Create Release
uses: ncipollo/release-action@v1.10.0
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: ${{ github.event.repository.name }}.zip
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

0 comments on commit b4fa646

Please sign in to comment.