Windows Release Build #1949
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows Release Build | |
| on: | |
| schedule: | |
| # every day at 6am | |
| - cron: "0 6 * * *" | |
| env: | |
| # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
| BUILD_TYPE: RelWithDebInfo | |
| REPO_DIR: ${{github.workspace}} | |
| BUILD_DIR: ${{github.workspace}}/bin/builddir | |
| BOOST_TOOLSET: "msvc" | |
| BOOST_VERSION: "1.87.0" | |
| BOOST_PLATFORM_VERSION: "2022" | |
| jobs: | |
| build: | |
| runs-on: windows-2022 | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| - OPTIONAL_DEFINES: "" | |
| TYPE: "default" | |
| - OPTIONAL_DEFINES: "-DBUILD_EXTRACTORS=ON -DBUILD_PLAYERBOTS=ON -DBUILD_AHBOT=ON -DBUILD_RECASTDEMOMOD=ON -DBUILD_GIT_ID=ON" | |
| TYPE: "with-all" | |
| - OPTIONAL_DEFINES: "-DBUILD_PLAYERBOTS=ON -DBUILD_AHBOT=ON" | |
| TYPE: "with-playerbot-ahbot" | |
| - OPTIONAL_DEFINES: "-DBUILD_PLAYERBOTS=ON" | |
| TYPE: "with-playerbot" | |
| - OPTIONAL_DEFINES: "-DBUILD_AHBOT=ON" | |
| TYPE: "with-ahbot" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| path: ${{env.REPO_DIR}} | |
| - uses: FranzDiebold/github-env-vars-action@v2 | |
| - name: Create Build Environment | |
| run: | | |
| echo "ARCHIVE_FILENAME=$env:CI_REPOSITORY_NAME-${{matrix.TYPE}}-$env:CI_SHA_SHORT.zip" >> $env:GITHUB_ENV | |
| cmake -E make_directory ${{ env.BUILD_DIR }} | |
| # install dependencies — install-boost provides BoostConfig.cmake, which | |
| # find_package(Boost) now requires (config mode); choco's boost-msvc | |
| # package is not discoverable that way. | |
| - name: Install Boost | |
| uses: MarkusJx/install-boost@v2.6.0 | |
| id: install-boost | |
| with: | |
| boost_version: ${{env.BOOST_VERSION}} | |
| platform_version: ${{env.BOOST_PLATFORM_VERSION}} | |
| toolset: ${{env.BOOST_TOOLSET}} | |
| - name: Configure | |
| env: | |
| BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} | |
| run: cmake ${{matrix.OPTIONAL_DEFINES}} -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} | |
| - name: Build | |
| env: | |
| MAKEFLAGS: "-j8" | |
| run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}} --parallel | |
| - name: Archive files | |
| run: | | |
| cd ${{env.BUILD_DIR}}/bin | |
| 7z a -tzip ${{env.ARCHIVE_FILENAME}} "x64_${{env.BUILD_TYPE}}" | |
| - name: Archive The Artefact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: snapshot-${{matrix.TYPE}} | |
| path: "${{env.BUILD_DIR}}/bin/${{env.ARCHIVE_FILENAME}}" | |
| upload: | |
| runs-on: windows-2022 | |
| permissions: | |
| contents: write # for softprops/action-gh-release to publish the release | |
| needs: build | |
| steps: | |
| - name: Download Artifact snapshot-default | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: snapshot-default | |
| path: all_snapshots | |
| - name: Download Artifact snapshot-with-all | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: snapshot-with-all | |
| path: all_snapshots | |
| - name: Download Artifact snapshot-with-playerbot-ahbot | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: snapshot-with-playerbot-ahbot | |
| path: all_snapshots | |
| - name: Download Artifact snapshot-with-playerbot | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: snapshot-with-playerbot | |
| path: all_snapshots | |
| - name: Download Artifact snapshot-with-ahbot | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: snapshot-with-ahbot | |
| path: all_snapshots | |
| - name: Get Current Date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Upload Snapshot | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: latest | |
| name: "Development Build(${{ steps.date.outputs.date }})" | |
| prerelease: false | |
| files: all_snapshots/** | |
| notify-success: | |
| name: Send Notification to Discord on Success | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: none | |
| needs: | |
| - upload | |
| steps: | |
| - name: Set Environmental Variables | |
| run: | | |
| echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
| shortSHA=`echo ${GITHUB_SHA} | cut -c1-8` | |
| echo "GIT_SHORT_SHA=${shortSHA}" >> $GITHUB_ENV | |
| projectNames="${GITHUB_REPOSITORY#*/}" | |
| expansion="${projectNames#*-}" | |
| echo "EXPANSION_NAME=${expansion}" >> $GITHUB_ENV | |
| echo "DEFAULT_ARCH_NAME=${projectNames}-default-${shortSHA}.zip" >> $GITHUB_ENV | |
| echo "ALL_ARCH_NAME=${projectNames}-with-all-${shortSHA}.zip" >> $GITHUB_ENV | |
| echo "AB_ARCH_NAME=${projectNames}-with-ahbot-${shortSHA}.zip" >> $GITHUB_ENV | |
| echo "PB_ARCH_NAME=${projectNames}-with-playerbot-${shortSHA}.zip" >> $GITHUB_ENV | |
| echo "PB_AB_ARCH_NAME=${projectNames}-with-playerbot-ahbot-${shortSHA}.zip" >> $GITHUB_ENV | |
| - name: Notify | |
| uses: rjstone/discord-webhook-notify@v2.2.1 | |
| with: | |
| severity: info | |
| description: | | |
| **New ${{env.EXPANSION_NAME}} Prebuild Released!** | |
| details: | | |
| **Branch:** ${{env.GIT_BRANCH}} | |
| __**Windows Prebuilt Binaries**__ | |
| - [Default Download](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.DEFAULT_ARCH_NAME}}) | |
| - [All Options Enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.ALL_ARCH_NAME}}) | |
| - [AHBot Enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.AB_ARCH_NAME}}) | |
| - [PlayerBots Enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.PB_ARCH_NAME}}) | |
| - [AHBot & PlayerBots Enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.PB_AB_ARCH_NAME}}) | |
| If you find any bugs or issues please report them [here](https://github.com/cmangos/issues/issues/new/choose). | |
| footer: Created by the CMaNGOS Team! | |
| webhookUrl: ${{ secrets.DISCORD_WEBHOOK_RELEASE }} | |
| notify: | |
| name: Send Notification to Discord on Failure | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: none | |
| needs: # make sure the notification is sent AFTER the jobs you want included have completed | |
| - build | |
| if: failure() | |
| steps: | |
| - name: Env | |
| run: | | |
| echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
| echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
| - name: Notify | |
| uses: rjstone/discord-webhook-notify@v2.2.1 | |
| with: | |
| severity: error | |
| description: | | |
| **Windows Build Failed** | |
| details: | | |
| - **Branch:** ${{env.GIT_BRANCH}} | |
| - **Pusher:** ${{github.event.pusher.name}} | |
| - **Author:** ${{github.event.head_commit.author.name}} | |
| - **Commit:** [${{github.repository}}/${{env.GIT_SHORT_SHA}}](${{github.server_url}}/${{ github.repository }}/commit/${{github.sha}}) | |
| - **Build Log:** [actions/runs/${{github.run_id}}](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}) | |
| footer: CMaNGOS Developers Notified! | |
| webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} |