From acf618a78cec0419a997f97c469e58f3fe9b3d4c Mon Sep 17 00:00:00 2001 From: Razish Date: Tue, 13 Feb 2024 23:05:00 +1100 Subject: [PATCH] update actions to supported versions, use correct SHA for PRs Co-authored-by: tayst --- .github/workflows/build.yml | 97 +++++++++++++++++++++++++++---------- CMakeLists.txt | 1 + 2 files changed, 72 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4418953d8..d249112ab8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,10 +36,21 @@ jobs: platform: x64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true + ref: ${{ github.event.pull_request.head.sha }} + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.1 + uses: microsoft/setup-msbuild@v1.3.2 - name: Create Build Environment run: cmake -E make_directory ${{ github.workspace }}/build @@ -68,14 +79,14 @@ jobs: shell: bash run: cmake --install . --config ${{ matrix.build_type }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} path: ${{ github.workspace }}/build/bin/JediAcademy if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJO-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} @@ -95,9 +106,23 @@ jobs: platform: Win32 - arch: x86_64 platform: x64 + exclude: + - build_type: Debug + portable: Portable steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true + ref: ${{ github.event.pull_request.head.sha }} + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true - name: Install v141_xp Toolchain continue-on-error: true @@ -114,7 +139,7 @@ jobs: Write-Host "components were not installed" } - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.1 + uses: microsoft/setup-msbuild@v1.3.2 - name: Create Build Environment run: cmake -E make_directory ${{ github.workspace }}/build @@ -143,14 +168,14 @@ jobs: shell: bash run: cmake --install . --config ${{ matrix.build_type }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-windowsxp-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} path: ${{ github.workspace }}/build/bin/JediAcademy if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJO-windowsxp-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} @@ -168,7 +193,18 @@ jobs: portable: [Non-Portable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true + ref: ${{ github.event.pull_request.head.sha }} + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true - name: Create Build Environment run: | @@ -195,6 +231,7 @@ jobs: else OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF" fi + if [ ${{ matrix.arch }} == "x86" ]; then OPTIONS+=" -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/linux-i686.cmake" fi @@ -224,14 +261,14 @@ jobs: shell: bash run: tar -czvf OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} path: ${{github.workspace}}/install/JediAcademy/OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} @@ -249,7 +286,18 @@ jobs: portable: [Non-Portable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true + ref: ${{ github.event.pull_request.head.sha }} + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + with: + fetch-depth: 0 + fetch-tags: true - name: Create Build Environment run: | @@ -284,26 +332,22 @@ jobs: if: ${{ matrix.build_type == 'Release' }} working-directory: ${{ github.workspace }}/install/JediAcademy shell: bash - run: | - chmod +x openjk.x86_64.app/Contents/MacOS/openjk.x86_64 - tar -czvf openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + run: tar -czvf openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * - name: Create OpenJO binary archive if: ${{ matrix.build_type == 'Release' }} working-directory: ${{ github.workspace }}/install/JediOutcast shell: bash - run: | - chmod +x openjo_sp.x86_64.app/Contents/MacOS/openjo_sp.x86_64 - tar -czvf openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * + run: tar -czvf openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz * - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} path: ${{ github.workspace }}/install/JediAcademy/openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: OpenJO-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} @@ -315,12 +359,12 @@ jobs: needs: [msvc, ubuntu, macos] runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: Download Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: Create binary archives run: | @@ -337,10 +381,11 @@ jobs: mv ./OpenJO-macos-x86_64-Release-Non-Portable/* OpenJO-macos-x86_64.tar.gz - name: Create latest build - uses: marvinpinto/action-automatic-releases@latest + uses: softprops/action-gh-release@v1 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: "latest" + generate_release_notes: true + tag_name: "latest" prerelease: false title: Latest Build files: | @@ -396,12 +441,12 @@ jobs: zip: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: Download Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: Create archive run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 6357912f84..c663aec3a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,6 +326,7 @@ endif() # ideally we would separate the hash suffix into its own variable, but sed is not available everywhere execute_process( COMMAND "git" "describe" "--tag" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_TAG RESULT_VARIABLE GIT_TAG_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE)