From d1045ba6e6fd4d8cf50487a290763ac46dbfc2fe Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:22:50 +1030 Subject: [PATCH 01/16] add a new action to update game versions Optional arg to commit the changes --- .github/actions/set_version/action.yaml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/actions/set_version/action.yaml diff --git a/.github/actions/set_version/action.yaml b/.github/actions/set_version/action.yaml new file mode 100644 index 0000000000..69c1024238 --- /dev/null +++ b/.github/actions/set_version/action.yaml @@ -0,0 +1,37 @@ +name: 'Set Version' +description: 'Updates all references to the current game version' +inputs: + new_release_version: + description: 'The new version string' + required: true + commit_changes: + description: 'Whether to commit the changes or not' + required: false + default: "false" +runs: + using: "composite" + steps: + - name: Set Constants.h GameVersion + run: sed -i -E '/c_GameVersion = /s/"[^"]*"/"${{inputs.new_release_version}}"/' System/Constants.h + shell: bash + + - uses: actions/setup-python@v3 + + - name: Rewrite meson version + run: | + pip install meson + meson rewrite kwargs set project // version ${{ inputs.new_release_version }} + shell: bash + + - name: Commit and push Version Changes + if: ${{ inputs.commit_changes == 'true' }} + shell: bash + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + git add System/GameVersion.h meson.build + git commit -m "Update version" || echo "No changes to commit" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From bdfdaeff37ad29b6cb756e6beb850f7b51f63233 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:23:06 +1030 Subject: [PATCH 02/16] move release bundling into a dedicated action --- .github/actions/bundle_release/action.yaml | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/actions/bundle_release/action.yaml diff --git a/.github/actions/bundle_release/action.yaml b/.github/actions/bundle_release/action.yaml new file mode 100644 index 0000000000..9774653ed3 --- /dev/null +++ b/.github/actions/bundle_release/action.yaml @@ -0,0 +1,48 @@ +name: 'Bundle Release Assets' +description: 'Downloads build assets and packages them into a zip file along with game data and libraries' +runs: + using: "composite" + steps: + - run: mkdir release + shell: bash + + - name: Download build artefacts + uses: actions/download-artifact@v3 + with: + path: release + + - run: ls -R release + shell: bash + + - name: Compress Windows Release + shell: bash + run: | + zip -j CortexCommand.windows.zip \ + "release/Cortex Command.exe" \ + external/lib/win/{fmod,SDL2}.dll + + - name: Compress Linux Release + shell: bash + run: | + zip -j CortexCommand.linux.zip \ + "release/CortexCommand (Linux)/CortexCommand.AppImage" \ + external/lib/linux/x86_64/libfmod.so* + + - name: Compress OSX Release + shell: bash + run: | + zip -j CortexCommand.macos.zip \ + "release/CortexCommand (macOS)/CortexCommand" \ + external/lib/macos/libfmod.dylib + + - name: Package Data files + shell: bash + run: | + zip -r -u CortexCommand.windows.zip Data + zip -r -u CortexCommand.linux.zip Data + zip -r -u CortexCommand.macos.zip Data + + + + + \ No newline at end of file From a5eca2fcd957b0efcea67cf5f1d4f27d81e4b110 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:23:33 +1030 Subject: [PATCH 03/16] add input args to set game version on build scripts --- .github/workflows/meson.yml | 24 +++++++++++++++++++++--- .github/workflows/msbuild.yml | 13 ++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 6726e6b9b0..3595ba6bf0 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -26,6 +26,9 @@ on: - "release" - "minimal" - "full" + new_release_version: + type: string + required: false # Triggers the workflow when called by a top-level workflow workflow_call: @@ -42,6 +45,9 @@ on: type: string required: false default: "release" + new_release_version: + type: string + required: false jobs: build-linux: @@ -59,6 +65,12 @@ jobs: sudo apt-get install --no-install-recommends wget liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev liblua5.2-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev libboost-dev libtbb-dev libsdl2-dev libsdl2-image-dev libopengl-dev libfuse2 ninja-build sudo pip install meson + - name: Set Version + if: ${{inputs.new_release_version}} + uses: ./.github/actions/set_version + with: + new_release_version: ${{inputs.new_release_version}} + - name: Setup Meson env: CC: "gcc" @@ -114,7 +126,7 @@ jobs: build-macos: runs-on: macos-11 name: MacOS Build - + env: GCC_VERSION: "13" MACOSX_DEPLOYMENT_TARGET: 10.15 @@ -124,8 +136,14 @@ jobs: - name: "Install Dependencies" uses: melusina-org/setup-macports@v1 - with: - parameters: ".github/parameters/macports.yml" + with: + parameters: ".github/parameters/macports.yml" + + - name: Set Version + if: ${{inputs.new_release_version}} + uses: ./.github/actions/set_version + with: + new_release_version: ${{inputs.new_release_version}} - name: Setup Meson env: diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 219d70121d..051eefce7f 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -19,6 +19,9 @@ on: - "Debug Release" - "Debug Minimal" - "Debug Full" + new_release_version: + type: string + required: false # Triggers the workflow when called by a top-level workflow workflow_call: @@ -31,7 +34,9 @@ on: type: string required: false default: "Final" - + new_release_version: + type: string + required: false env: # Path to the solution file relative to the root of the project. SOLUTION_FILE_PATH: RTEA.sln @@ -54,6 +59,12 @@ jobs: - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1 + - name: Set Version + if: ${{inputs.new_release_version}} + uses: ./.github/actions/set_version + with: + new_release_version: ${{inputs.new_release_version}} + - name: Build working-directory: ${{env.GITHUB_WORKSPACE}} # Add additional options to the MSBuild command line here (like platform or verbosity level). From 46d64bbb7614044b19f5d48bd3b6a39974bb5fd8 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:23:49 +1030 Subject: [PATCH 04/16] add a new release workflow to publish releases --- .github/workflows/release.yaml | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000000..f1a270bba9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,81 @@ +name: Build and Release +# Controls when the action will run. +on: + workflow_dispatch: + inputs: + new_release_version: + description: "New version number to release" + type: string + required: true + +concurrency: + group: release-${{ github.ref_name }} + +env: + LATEST_TAG: latest + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build-meson-releases: + name: Linux & macOS Release Builds + + uses: ./.github/workflows/meson.yml + with: + upload_artefacts: true + new_release_version: ${{ github.event.inputs.new_release_version }} + + build-msbuild-releases: + name: Windows Release Build + + uses: ./.github/workflows/msbuild.yml + with: + upload_artefacts: true + new_release_version: ${{ github.event.inputs.new_release_version }} + + release: + name: Publish Release + runs-on: ubuntu-latest + + needs: [build-msbuild-releases, build-meson-releases] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: fetch tags + run: git fetch --tags origin + + - name: Set Version + if: ${{ github.event.inputs.new_release_version}} + uses: ./.github/actions/set_version + with: + new_release_version: ${{ github.event.inputs.new_release_version}} + commit_changes: true + + - name: Bundle release assets + uses: ./.github/actions/bundle_release + + - name: Create a new Release + run: | + gh release create ${{ github.event.inputs.new_release_version }} \ + --title "Release ${{ github.event.inputs.new_release_version }}" \ + --generate-notes \ + --draft \ + ${{format('--notes-start-tag {0}', env.LATEST_TAG) || ''}} \ + --prerelease \ + 'CortexCommand.windows.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (Windows Release)' \ + 'CortexCommand.linux.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (Linux Release)' \ + 'CortexCommand.macos.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (macOS Release)' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update latest tag + run: | + curl -X POST \ + -H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/git/refs \ + -d '{ + "ref": "refs/tags/${{ env.LATEST_TAG }}", + "sha": "${{ github.sha }}" + }' From 6b6829a803e54bc6387ab0848cb5bb805c209fdb Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:31:40 +1030 Subject: [PATCH 05/16] add missing `v` version prefix --- .github/workflows/release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f1a270bba9..17d65b5b0f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -57,15 +57,15 @@ jobs: - name: Create a new Release run: | - gh release create ${{ github.event.inputs.new_release_version }} \ + gh release create v${{ github.event.inputs.new_release_version }} \ --title "Release ${{ github.event.inputs.new_release_version }}" \ --generate-notes \ --draft \ ${{format('--notes-start-tag {0}', env.LATEST_TAG) || ''}} \ --prerelease \ - 'CortexCommand.windows.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (Windows Release)' \ - 'CortexCommand.linux.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (Linux Release)' \ - 'CortexCommand.macos.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (macOS Release)' + 'CortexCommand.windows.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Windows Release)' \ + 'CortexCommand.linux.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Linux Release)' \ + 'CortexCommand.macos.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (macOS Release)' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c643859870a2ebffe1778cfde4253d0de4b4e7f6 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:41:28 +1030 Subject: [PATCH 06/16] add github token secret to action --- .github/actions/set_version/action.yaml | 5 ++++- .github/workflows/meson.yml | 2 ++ .github/workflows/msbuild.yml | 1 + .github/workflows/release.yaml | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/set_version/action.yaml b/.github/actions/set_version/action.yaml index 69c1024238..2053824406 100644 --- a/.github/actions/set_version/action.yaml +++ b/.github/actions/set_version/action.yaml @@ -8,6 +8,9 @@ inputs: description: 'Whether to commit the changes or not' required: false default: "false" + github_token: + description: 'GitHub token' + required: true runs: using: "composite" steps: @@ -33,5 +36,5 @@ runs: git commit -m "Update version" || echo "No changes to commit" git push env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ inputs.github_token }} diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 3595ba6bf0..f52877bd8b 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -70,6 +70,7 @@ jobs: uses: ./.github/actions/set_version with: new_release_version: ${{inputs.new_release_version}} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Meson env: @@ -144,6 +145,7 @@ jobs: uses: ./.github/actions/set_version with: new_release_version: ${{inputs.new_release_version}} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Meson env: diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 051eefce7f..57f2d2656d 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -64,6 +64,7 @@ jobs: uses: ./.github/actions/set_version with: new_release_version: ${{inputs.new_release_version}} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build working-directory: ${{env.GITHUB_WORKSPACE}} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 17d65b5b0f..9deb11e2c5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -51,6 +51,7 @@ jobs: with: new_release_version: ${{ github.event.inputs.new_release_version}} commit_changes: true + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Bundle release assets uses: ./.github/actions/bundle_release From 724f443b6f3cdb0571151a8e4bbddd6de0787a8c Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 16:46:30 +1030 Subject: [PATCH 07/16] fix bad path on gameversion --- .github/actions/set_version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/set_version/action.yaml b/.github/actions/set_version/action.yaml index 2053824406..96d0168354 100644 --- a/.github/actions/set_version/action.yaml +++ b/.github/actions/set_version/action.yaml @@ -15,7 +15,7 @@ runs: using: "composite" steps: - name: Set Constants.h GameVersion - run: sed -i -E '/c_GameVersion = /s/"[^"]*"/"${{inputs.new_release_version}}"/' System/Constants.h + run: sed -i -E '/c_VersionString = /s/"[^"]*"/"${{inputs.new_release_version}}"/' Source/System/GameVersion.h shell: bash - uses: actions/setup-python@v3 From 5f9251a649aadab57a560e8ac4db8e0afdd4696f Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 17:04:32 +1030 Subject: [PATCH 08/16] fix bad commit path --- .github/actions/set_version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/set_version/action.yaml b/.github/actions/set_version/action.yaml index 96d0168354..a0a921fb33 100644 --- a/.github/actions/set_version/action.yaml +++ b/.github/actions/set_version/action.yaml @@ -32,7 +32,7 @@ runs: run: | git config --global user.email "action@github.com" git config --global user.name "GitHub Action" - git add System/GameVersion.h meson.build + git add Source/System/GameVersion.h meson.build git commit -m "Update version" || echo "No changes to commit" git push env: From 24be634cb46a5f77f2d86e38cea84e79701c5e29 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 17:29:37 +1030 Subject: [PATCH 09/16] disable prerelease --- .github/workflows/release.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9deb11e2c5..fab24d89c1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -63,7 +63,6 @@ jobs: --generate-notes \ --draft \ ${{format('--notes-start-tag {0}', env.LATEST_TAG) || ''}} \ - --prerelease \ 'CortexCommand.windows.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Windows Release)' \ 'CortexCommand.linux.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Linux Release)' \ 'CortexCommand.macos.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (macOS Release)' From 9d0603ab95c55b7cc1448f678f2f5e52c9baff4b Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 7 Jan 2024 17:31:10 +1030 Subject: [PATCH 10/16] force update the latest tag --- .github/workflows/release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fab24d89c1..0b9fda98c9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -77,5 +77,6 @@ jobs: https://api.github.com/repos/${{ github.repository }}/git/refs \ -d '{ "ref": "refs/tags/${{ env.LATEST_TAG }}", - "sha": "${{ github.sha }}" + "sha": "${{ github.sha }}", + "force": true }' From b8aba0dae70bafc46661d9e40a1909ccb0f16b48 Mon Sep 17 00:00:00 2001 From: Stuart Date: Mon, 8 Jan 2024 23:11:22 +1030 Subject: [PATCH 11/16] fix tagging issues --- .github/workflows/release.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0b9fda98c9..c7494c07e2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -71,12 +71,10 @@ jobs: - name: Update latest tag run: | - curl -X POST \ + curl -X PATCH \ -H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/git/refs \ + https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.LATEST_TAG }} \ -d '{ - "ref": "refs/tags/${{ env.LATEST_TAG }}", "sha": "${{ github.sha }}", - "force": true }' From d2d0f2e8ff2f71413168f5df046693d3d978e176 Mon Sep 17 00:00:00 2001 From: Stuart Date: Mon, 8 Jan 2024 23:50:58 +1030 Subject: [PATCH 12/16] fix json --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c7494c07e2..8a249f25fd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -76,5 +76,5 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.LATEST_TAG }} \ -d '{ - "sha": "${{ github.sha }}", + "sha": "${{ github.sha }}" }' From c86b105ff02fa2d24d8afa1a4fdaaa3821f60b0b Mon Sep 17 00:00:00 2001 From: Stuart Date: Fri, 12 Jan 2024 22:09:26 +1030 Subject: [PATCH 13/16] chore: move release tag to after release is successful --- .github/actions/set_version/action.yaml | 20 -------------------- .github/workflows/release.yaml | 13 +++++++++++-- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/.github/actions/set_version/action.yaml b/.github/actions/set_version/action.yaml index a0a921fb33..5d61d2f107 100644 --- a/.github/actions/set_version/action.yaml +++ b/.github/actions/set_version/action.yaml @@ -4,13 +4,6 @@ inputs: new_release_version: description: 'The new version string' required: true - commit_changes: - description: 'Whether to commit the changes or not' - required: false - default: "false" - github_token: - description: 'GitHub token' - required: true runs: using: "composite" steps: @@ -25,16 +18,3 @@ runs: pip install meson meson rewrite kwargs set project // version ${{ inputs.new_release_version }} shell: bash - - - name: Commit and push Version Changes - if: ${{ inputs.commit_changes == 'true' }} - shell: bash - run: | - git config --global user.email "action@github.com" - git config --global user.name "GitHub Action" - git add Source/System/GameVersion.h meson.build - git commit -m "Update version" || echo "No changes to commit" - git push - env: - GITHUB_TOKEN: ${{ inputs.github_token }} - diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8a249f25fd..d77fc0ba68 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -50,8 +50,6 @@ jobs: uses: ./.github/actions/set_version with: new_release_version: ${{ github.event.inputs.new_release_version}} - commit_changes: true - github_token: ${{ secrets.GITHUB_TOKEN }} - name: Bundle release assets uses: ./.github/actions/bundle_release @@ -69,6 +67,17 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Commit and push Version Changes + shell: bash + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + git add Source/System/GameVersion.h meson.build + git commit -m "Release v${{ inputs.new_release_version }}" || echo "No changes to commit" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} + - name: Update latest tag run: | curl -X PATCH \ From c178323622392c329472bda8aeed9c3f3f4f7d0a Mon Sep 17 00:00:00 2001 From: Stuart Date: Fri, 12 Jan 2024 22:32:28 +1030 Subject: [PATCH 14/16] chore: remove old master build --- .github/workflows/master_build.yaml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/master_build.yaml diff --git a/.github/workflows/master_build.yaml b/.github/workflows/master_build.yaml deleted file mode 100644 index e613f5ab94..0000000000 --- a/.github/workflows/master_build.yaml +++ /dev/null @@ -1,27 +0,0 @@ - -name: Master Build - -on: - # Triggers the workflow for pushes to master - push: - branches: [master] - - workflow_dispatch: - -# Cancel in-progress runs if newer changes to the same branch/PR are pushed. -concurrency: - group: ci-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -# Build the game on all platforms and store build artefacts of both jobs -jobs: - meson: - uses: ./.github/workflows/meson.yml - with: - upload_artefacts: true - - msbuild: - uses: ./.github/workflows/msbuild.yml - with: - upload_artefacts: true - From 4ffa01cbdefb10e3afe2d92eee60d671c34982fa Mon Sep 17 00:00:00 2001 From: Stuart Date: Fri, 12 Jan 2024 22:44:32 +1030 Subject: [PATCH 15/16] ci: merge release commit and tag steps --- .github/workflows/release.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d77fc0ba68..7a3195612c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -67,7 +67,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Commit and push Version Changes + - name: Commit and push Version Changes and Update latest tag shell: bash run: | git config --global user.email "action@github.com" @@ -75,15 +75,14 @@ jobs: git add Source/System/GameVersion.h meson.build git commit -m "Release v${{ inputs.new_release_version }}" || echo "No changes to commit" git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} - - name: Update latest tag - run: | + RELEASE_COMMIT=$(git rev-parse HEAD) curl -X PATCH \ -H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.LATEST_TAG }} \ -d '{ - "sha": "${{ github.sha }}" + "sha": "$RELEASE_COMMIT", }' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} From 750a69af0dfbb55fc81b1d35e3aead498cf74d26 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sat, 13 Jan 2024 02:26:55 +1030 Subject: [PATCH 16/16] fix: publish releases to correct branch, tag latest on same branch --- .github/workflows/release.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7a3195612c..527fb3014e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -60,6 +60,7 @@ jobs: --title "Release ${{ github.event.inputs.new_release_version }}" \ --generate-notes \ --draft \ + --target ${{ github.ref_name }} \ ${{format('--notes-start-tag {0}', env.LATEST_TAG) || ''}} \ 'CortexCommand.windows.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Windows Release)' \ 'CortexCommand.linux.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Linux Release)' \ @@ -82,7 +83,8 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.LATEST_TAG }} \ -d '{ - "sha": "$RELEASE_COMMIT", + "sha": "'"$RELEASE_COMMIT"'", + "ref": "${{ github.ref }}" }' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}