diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87cf88a..293f9a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,22 +2,16 @@ name: build on: push: - branches: [ master ] + branches: [ master, CI ] pull_request: branches: [ master ] workflow_dispatch: jobs: check-secret: - runs-on: ubuntu-latest - outputs: - has-password: ${{ steps.has-password.outputs.defined }} - steps: - - id: has-password - if: "${{ env.KSP_ZIP_PASSWORD != '' }}" - run: echo "::set-output name=defined::true" - env: - KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }} + uses: KSP-RO/BuildTools/.github/workflows/check-secret.yml@master + secrets: + KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }} validate-cfg-files: runs-on: ubuntu-latest steps: @@ -28,7 +22,7 @@ jobs: - name: Validate config files uses: KSP-CKAN/KSPMMCfgParser@master build: - runs-on: windows-latest + runs-on: ubuntu-latest needs: [check-secret] if: needs.check-secret.outputs.has-password == 'true' steps: @@ -36,25 +30,37 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 100 + - name: Download required assemblies id: download-assemblies - shell: pwsh - env: + uses: KSP-RO/BuildTools/download-assemblies@master + with: KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }} - run: | - Invoke-WebRequest https://ksp-ro.s3-us-west-2.amazonaws.com/KSPAssemblies-1.12.zip -OutFile KSP_Assemblies.zip - $KSP_DLL_PATH="${env:GITHUB_WORKSPACE}/KSP_Assemblies" - echo "::set-output name=ksp-dll-path::${KSP_DLL_PATH}" - mkdir -p "${KSP_DLL_PATH}" - 7z.exe x "-p${env:KSP_ZIP_PASSWORD}" 'KSP_Assemblies.zip' "-o${KSP_DLL_PATH}" - rm 'KSP_Assemblies.zip' + + # Install .NET SDKs + - name: Setup .NET Core 3.1 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x + - name: Setup .NET 5.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 + - name: Update AssemblyInfo + uses: KSP-RO/BuildTools/update-assembly-info@master + with: + path: ${GITHUB_WORKSPACE}/src/RealAntennasProject/Properties/AssemblyInfo.cs + tag: "2.99.0.0" - name: Build mod solution run: | - msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${env:GITHUB_WORKSPACE}/src/RealAntennasProject.sln + msbuild ${env:GITHUB_WORKSPACE}/src/RealAntennasProject.sln /t:build /restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" + + - name: Remove excess DLLs + uses: KSP-RO/BuildTools/remove-excess-dlls@master + with: + path: ${GITHUB_WORKSPACE}/GameData/ - name: Assemble release id: assemble-release @@ -69,4 +75,4 @@ jobs: uses: actions/upload-artifact@v1 with: name: RealAntennas - path: ${{ steps.assemble-release.outputs.release-dir }} \ No newline at end of file + path: ${{ steps.assemble-release.outputs.release-dir }} diff --git a/src/RealAntennasProject/Properties/AssemblyInfo.cs b/src/RealAntennasProject/Properties/AssemblyInfo.cs index 75a809a..38988fc 100644 --- a/src/RealAntennasProject/Properties/AssemblyInfo.cs +++ b/src/RealAntennasProject/Properties/AssemblyInfo.cs @@ -1,5 +1,5 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +#define CIBUILD_disabled +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,7 +33,12 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.4.0.0")] -[assembly: AssemblyFileVersion("2.4.0.0")] -[assembly: KSPAssembly("RealAntennas", 2, 4)] +#if CIBUILD +[assembly: AssemblyFileVersion("@MAJOR@.@MINOR@.@PATCH@.@BUILD@")] +[assembly: KSPAssembly("RealAntennas", @MAJOR@, @MINOR@)] +#else +[assembly: AssemblyFileVersion("2.99.0.0")] +[assembly: KSPAssembly("RealAntennas", 2, 99)] +#endif [assembly: KSPAssemblyDependency("ClickThroughBlocker", 1, 8)]