|
| 1 | +name: MSBuild |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + |
| 7 | +env: |
| 8 | + SOLUTION_FILE_PATH: SHOWOFF-NVSE/ShowOffNVSE.sln |
| 9 | + |
| 10 | +permissions: write-all |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: windows-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Add MSBuild to PATH |
| 20 | + uses: microsoft/setup-msbuild@v2 |
| 21 | + |
| 22 | + - name: Build Release |
| 23 | + working-directory: ${{env.GITHUB_WORKSPACE}} |
| 24 | + run: msbuild /m /p:Configuration=Release ${{env.SOLUTION_FILE_PATH}} /p:PostBuildEventUseInBuild=false |
| 25 | + |
| 26 | + - name: Build Debug |
| 27 | + working-directory: ${{env.GITHUB_WORKSPACE}} |
| 28 | + run: msbuild /m /p:Configuration=Debug ${{env.SOLUTION_FILE_PATH}} /p:PostBuildEventUseInBuild=false |
| 29 | + |
| 30 | + - name: Generate Timestamp |
| 31 | + run: | |
| 32 | + timestamp=$(date +"%Y%m%d%H%M%S") |
| 33 | + echo "artifact_timestamp=$timestamp" >> $GITHUB_ENV |
| 34 | + shell: bash |
| 35 | + |
| 36 | + - name: Package Artifacts |
| 37 | + run: | |
| 38 | + mkdir -p artifacts |
| 39 | + Compress-Archive -Path SHOWOFF-NVSE\Release\ShowOffNVSE.dll, SHOWOFF-NVSE\Release\ShowOffNVSE.pdb -DestinationPath artifacts\ShowOffNVSE-Release-${{ env.artifact_timestamp }}.zip |
| 40 | + Compress-Archive -Path SHOWOFF-NVSE\Debug\ShowOffNVSE.dll, SHOWOFF-NVSE\Debug\ShowOffNVSE.pdb -DestinationPath artifacts\ShowOffNVSE-Debug-${{ env.artifact_timestamp }}.zip |
| 41 | + shell: pwsh |
| 42 | + |
| 43 | + - name: Publish Zipped Artifacts |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: Zipped-Artifacts-${{ env.artifact_timestamp }} |
| 47 | + path: artifacts/ |
| 48 | + |
| 49 | + - name: Get Release |
| 50 | + id: get_release |
| 51 | + uses: cardinalby/git-get-release-action@v1 |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + with: |
| 55 | + tag: 'continuous' |
| 56 | + doNotFailIfNotFound: true |
| 57 | + - name: Delete old release if exists |
| 58 | + if: steps.get_release.outputs.id != '' |
| 59 | + uses: dev-drprasad/delete-tag-and-release@v1.0 |
| 60 | + with: |
| 61 | + tag_name: continuous |
| 62 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + delete_release: true |
| 64 | + - name: Create Release |
| 65 | + id: create_release |
| 66 | + uses: actions/create-release@v1 |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + with: |
| 70 | + tag_name: continuous |
| 71 | + release_name: "Continuous release" |
| 72 | + draft: false |
| 73 | + prerelease: true |
| 74 | + body: | |
| 75 | + Continuous release generated from the latest push to development branch. |
| 76 | + - name: Upload Artifact (Release) |
| 77 | + uses: actions/upload-release-asset@v1 |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + with: |
| 81 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 82 | + asset_path: artifacts/ShowOffNVSE-Release-${{ env.artifact_timestamp }}.zip |
| 83 | + asset_name: ShowOffNVSE-Release-${{ env.artifact_timestamp }}.zip |
| 84 | + asset_content_type: application/zip |
| 85 | + - name: Upload Artifact (Debug) |
| 86 | + uses: actions/upload-release-asset@v1 |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + with: |
| 90 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 91 | + asset_path: artifacts/ShowOffNVSE-Debug-${{ env.artifact_timestamp }}.zip |
| 92 | + asset_name: ShowOffNVSE-Debug-${{ env.artifact_timestamp }}.zip |
| 93 | + asset_content_type: application/zip |
0 commit comments