|
| 1 | +name: Build Intersect |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main-net7" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main-net7" ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +env: |
| 13 | + VERSION_PREFIX: 0.7.2 |
| 14 | + VERSION_SUFFIX: -beta-net7. |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + |
| 19 | + runs-on: windows-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout Code |
| 23 | + uses: actions/checkout@v3 |
| 24 | + |
| 25 | + - name: Add msbuild to PATH |
| 26 | + uses: microsoft/setup-msbuild@v1.3.1 |
| 27 | + with: |
| 28 | + msbuild-architecture: x64 |
| 29 | + |
| 30 | + - name: Setup NuGet.exe for use with actions |
| 31 | + # You may pin to the exact commit or the version. |
| 32 | + # uses: NuGet/setup-nuget@fd9fffd6ca4541cf4152a9565835ca1a88a6eb37 |
| 33 | + uses: NuGet/setup-nuget@v1.1.1 |
| 34 | + with: |
| 35 | + # NuGet version to install. Can be `latest`, `preview`, a concrete version like `5.3.1`, or a semver range specifier like `5.x`. |
| 36 | + nuget-version: latest # optional, default is latest |
| 37 | + # NuGet API Key to configure. |
| 38 | + # nuget-api-key: # optional |
| 39 | + # Source to scope the NuGet API Key to. |
| 40 | + # nuget-api-key-source: # optional |
| 41 | + |
| 42 | + # - run: nuget locals all -list |
| 43 | + |
| 44 | + - name: Cache binaries |
| 45 | + uses: actions/cache@v3.2.6 |
| 46 | + id: cache-binaries |
| 47 | + with: |
| 48 | + path: | |
| 49 | + Intersect*/bin/Release/**/Intersect* |
| 50 | + key: ${{ runner.os }}-nuget-${{ hashFiles('Intersect.*/**/*.cs') }} |
| 51 | + |
| 52 | + - name: Cache NuGet dependencies |
| 53 | + uses: actions/cache@v3.2.6 |
| 54 | + id: cache |
| 55 | + if: steps.cache-binaries.outputs.cache-hit != 'true' |
| 56 | + with: |
| 57 | + path: | |
| 58 | + ~/.nuget/packages |
| 59 | + Intersect*/obj/project.assets.json |
| 60 | + key: ${{ runner.os }}-nuget-${{ hashFiles('Intersect.*/*.csproj') }} |
| 61 | + |
| 62 | + - name: Restore NuGet Packages |
| 63 | + if: steps.cache.outputs.cache-hit != 'true' || steps.cache-binaries.outputs.cache-hit != 'true' |
| 64 | + run: nuget restore Intersect.sln |
| 65 | + |
| 66 | + # - run: ls -R ~/.nuget/packages |
| 67 | + # - run: ls -R |
| 68 | + |
| 69 | + - name: Build solution |
| 70 | + if: steps.cache-binaries.outputs.cache-hit != 'true' |
| 71 | + run: msbuild Intersect.sln /p:Configuration=Release /p:PackageVersion=${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }}+build.${{ github.sha }} /p:Version=0.7.2.${{ github.run_number }} |
| 72 | + |
| 73 | + - name: Package artifacts |
| 74 | + run: | |
| 75 | + mkdir intersect-engine |
| 76 | + mkdir intersect-engine/client |
| 77 | + mkdir intersect-engine/editor |
| 78 | + mkdir intersect-engine/server |
| 79 | + Copy-Item -Path "Intersect.Client/LICENSE.md" -Destination "intersect-engine/client" |
| 80 | + Copy-Item -Path "Intersect.Client/bin/Release/**/Intersect Client.*" -Destination "intersect-engine/client" |
| 81 | + Copy-Item -Path "Intersect.Editor/LICENSE.md" -Destination "intersect-engine/editor" |
| 82 | + Copy-Item -Path "Intersect.Editor/bin/Release/**/Intersect Editor.*" -Destination "intersect-engine/editor" |
| 83 | + Copy-Item -Path "Intersect.Server/LICENSE.md" -Destination "intersect-engine/server" |
| 84 | + Copy-Item -Path "Intersect.Server/bin/Release/**/Intersect Server.*" -Destination "intersect-engine/server" |
| 85 | + Copy-Item -Path "AUTHORS.md" -Destination "intersect-engine" |
| 86 | + Copy-Item -Path "LICENSE.md" -Destination "intersect-engine" |
| 87 | + Copy-Item -Path "README.md" -Destination "intersect-engine" |
| 88 | + Copy-Item -Path "Documentation" -Destination "intersect-engine" -Recurse |
| 89 | + Compress-Archive -Path "intersect-engine" -DestinationPath "intersect-${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }}+build.${{ github.sha }}.zip" |
| 90 | +
|
| 91 | + # - name: Upload artifacts |
| 92 | + # uses: actions/upload-artifact@v3.1.2 |
| 93 | + # with: |
| 94 | + # if-no-files-found: error |
| 95 | + # name: intersect-${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }}+build.${{ github.sha }} |
| 96 | + # path: | |
| 97 | + # AUTHORS.md |
| 98 | + # Documentation/** |
| 99 | + # Intersect.*/LICENSE.md |
| 100 | + # Intersect.Client/bin/Release/**/Intersect Client.* |
| 101 | + # Intersect.Editor/bin/Release/**/Intersect Editor.* |
| 102 | + # Intersect.Server/bin/Release/**/Intersect Server.* |
| 103 | + # LICENSE.md |
| 104 | + # README.md |
| 105 | + # !Intersect.*/bin/Release/**/*.xml |
| 106 | + # !Intersect.*/bin/Release/**/*.runtimeconfig.* |
| 107 | + # retention-days: 1 |
| 108 | + |
| 109 | + # - name: Download artifacts |
| 110 | + # uses: actions/download-artifact@v3 |
| 111 | + # with: |
| 112 | + # name: intersect-${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }}+build.${{ github.sha }} |
| 113 | + # path: artifacts |
| 114 | + |
| 115 | + # - run: ls -R |
| 116 | + |
| 117 | + - name: Publish Release |
| 118 | + uses: softprops/action-gh-release@v0.1.15 |
| 119 | + with: |
| 120 | + files: "intersect-${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }}+build.${{ github.sha }}.zip" |
| 121 | + generate_release_notes: true |
| 122 | + prerelease: true |
| 123 | + name: ${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }} |
| 124 | + tag_name: v${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}${{ github.run_number }} |
| 125 | + target_commitish: ${{ github.sha }} |
0 commit comments