From 99541ba13991cd224991a907f41a2933376fc635 Mon Sep 17 00:00:00 2001 From: Stuart Date: Mon, 5 Dec 2022 21:31:52 +1030 Subject: [PATCH 01/17] style: renamed `build-check` workflow to Continuous Integration Renamed Workflow & workflow file. Added missing names to the two build jobs. Formatting (indentation) --- .github/workflows/build-check.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index d933b12b4..6ddb59f7e 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -1,4 +1,4 @@ -name: Compile check +name: Continuous Integration # Controls when the action will run. on: @@ -14,7 +14,7 @@ jobs: build-linux: # The type of runner that the job will run on runs-on: ubuntu-20.04 - + name: Linux Build # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -67,16 +67,16 @@ jobs: BUILD_CONFIGURATION: "Final" runs-on: windows-latest + name: Windows Build steps: - - uses: actions/checkout@v2 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + - uses: actions/checkout@v2 + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1 - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - # Add additional options to the MSBuild command line here (like platform or verbosity level). - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} + - name: Build + working-directory: ${{env.GITHUB_WORKSPACE}} + # Add additional options to the MSBuild command line here (like platform or verbosity level). + # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference + run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} From 352957c13f929192e985d69130d53fd81ea4b965 Mon Sep 17 00:00:00 2001 From: Stuart Date: Mon, 5 Dec 2022 21:33:24 +1030 Subject: [PATCH 02/17] ci: continuous integration now only runs on Pull Requests, not on merged code --- .github/workflows/{build-check.yml => ci.yml} | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) rename .github/workflows/{build-check.yml => ci.yml} (91%) diff --git a/.github/workflows/build-check.yml b/.github/workflows/ci.yml similarity index 91% rename from .github/workflows/build-check.yml rename to .github/workflows/ci.yml index 6ddb59f7e..008eb6267 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,8 @@ name: Continuous Integration -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the development branch - push: - branches: [master, development] + # Triggers the workflow on all pull request events pull_request: - types: [opened, reopened, ready_for_review, synchronize] workflow_dispatch: From 7ffbce1757b7b5f53ce63ab5c33a8af38868b7fe Mon Sep 17 00:00:00 2001 From: Stuart Date: Mon, 5 Dec 2022 21:49:14 +1030 Subject: [PATCH 03/17] ci: merge existing patform specific build workflows into one created a unified `build.yaml` workflow file, containing each of the platform-specific build jobs --- .github/workflows/build.yaml | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..5d74de1b7 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,113 @@ +name: Build +# Controls when the action will run. +on: + # Triggers the workflow on push to the development or master branches + push: + branches: [master, development] + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build-release-linux: + # The type of runner that the job will run on + runs-on: ubuntu-20.04 + name: Linux Release Build + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + + - name: Install Dependencies + run: | + sudo apt-get update -yq + 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 + + - name: Install Clang + # You may pin to the exact commit or the version. + # uses: egor-tensin/setup-clang@d16e36d5f8a7eb00aa6627c1a536d94dfc4a913d + uses: egor-tensin/setup-clang@v1 + with: + # Set up cc/c++ executables + cc: 1 # optional, default is 1 + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: build-release-${{runner.os}} + max-size: 5G + + - name: Build + # You may pin to the exact commit or the version. + # uses: BSFishy/meson-build@6f1930d878fd3eed3853c1c91285ec604c37f3a5 + uses: BSFishy/meson-build@v1.0.3 + env: + CC: "clang" + CXX: "clang++" + CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime + with: + # The action to run + setup-options: --buildtype=release -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ + meson-version: 0.60.0 + ninja-version: 1.10.2 + action: build + + - name: Create AppDir + run: | + echo "Setting output prefix" + DESTDIR=${GITHUB_WORKSPACE}/build/AppDir meson install -C $GITHUB_WORKSPACE"/build" + + - name: Download linuxdeploy + working-directory: ${{env.GITHUB_WORKSPACE}} + run: | + wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O lindeploy + chmod +x lindeploy + + - name: Create AppImage + working-directory: ${{env.GITHUB_WORKSPACE}} + env: + LD_LIBRARY_PATH: ./external/lib/linux/x86_64/ + OUTPUT: CortexCommand.AppImage + run: | + echo ${LD_LIBRARY_PATH} + ./lindeploy --appdir=build/AppDir --output appimage + + - name: Upload Appimage + uses: actions/upload-artifact@v2 + with: + name: CortexCommand.AppImage + path: CortexCommand.AppImage + + build-release-windows: + env: + # Path to the solution file relative to the root of the project. + SOLUTION_FILE_PATH: RTEA.sln + + # Configuration type to build. + # You can convert this to a build matrix if you need coverage of multiple configuration types. + # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + BUILD_CONFIGURATION: "Final" + + runs-on: windows-latest + name: Windows Release Build + + steps: + - uses: actions/checkout@v2 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: Build + working-directory: ${{env.GITHUB_WORKSPACE}} + # Add additional options to the MSBuild command line here (like platform or verbosity level). + # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference + run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} + + - name: Upload Artifact2 + uses: actions/upload-artifact@v2.2.2 + with: + name: Cortex Command.exe + path: D:/a/Cortex-Command-Community-Project-Source/Cortex-Command-Community-Project-Data/Cortex Command x64.exe + if-no-files-found: warn From ff22db0825871694f56b2f6cb0454af5871b5725 Mon Sep 17 00:00:00 2001 From: Stuart Date: Mon, 5 Dec 2022 21:52:21 +1030 Subject: [PATCH 04/17] ci: updated to actions/upload-artefact@v3 --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5d74de1b7..062c15742 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -75,7 +75,7 @@ jobs: ./lindeploy --appdir=build/AppDir --output appimage - name: Upload Appimage - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CortexCommand.AppImage path: CortexCommand.AppImage @@ -105,8 +105,8 @@ jobs: # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} - - name: Upload Artifact2 - uses: actions/upload-artifact@v2.2.2 + - name: Upload Artifact + uses: actions/upload-artifact@v3 with: name: Cortex Command.exe path: D:/a/Cortex-Command-Community-Project-Source/Cortex-Command-Community-Project-Data/Cortex Command x64.exe From a7da0dbbc6ae36dd9e511c4106419ee1647000b5 Mon Sep 17 00:00:00 2001 From: Stuart Date: Tue, 6 Dec 2022 22:31:53 +1030 Subject: [PATCH 05/17] ci: removed deprecated platform specific build workflows --- .github/workflows/meson.yml | 83 ----------------------------------- .github/workflows/msbuild.yml | 41 ----------------- 2 files changed, 124 deletions(-) delete mode 100644 .github/workflows/meson.yml delete mode 100644 .github/workflows/msbuild.yml diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml deleted file mode 100644 index 6b43dabd2..000000000 --- a/.github/workflows/meson.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Linux Build -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the development branch - push: - branches: [ master, development ] - release: - workflow_dispatch: - - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build-release-linux: - # The type of runner that the job will run on - runs-on: ubuntu-20.04 - - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - - name: Install Dependencies - run: | - sudo apt-get update -yq - 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 - - - name: Install Clang - # You may pin to the exact commit or the version. - # uses: egor-tensin/setup-clang@d16e36d5f8a7eb00aa6627c1a536d94dfc4a913d - uses: egor-tensin/setup-clang@v1 - with: - # Set up cc/c++ executables - cc: 1 # optional, default is 1 - - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: build-release-${{runner.os}} - max-size: 5G - - - name: Build - # You may pin to the exact commit or the version. - # uses: BSFishy/meson-build@6f1930d878fd3eed3853c1c91285ec604c37f3a5 - uses: BSFishy/meson-build@v1.0.3 - env: - CC: "clang" - CXX: "clang++" - CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime - with: - # The action to run - setup-options: --buildtype=release -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ - meson-version: 0.60.0 - ninja-version: 1.10.2 - action: build - - - name: Create AppDir - run: | - echo "Setting output prefix" - DESTDIR=${GITHUB_WORKSPACE}/build/AppDir meson install -C $GITHUB_WORKSPACE"/build" - - - name: Download linuxdeploy - working-directory: ${{env.GITHUB_WORKSPACE}} - run: | - wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O lindeploy - chmod +x lindeploy - - - name: Create AppImage - working-directory: ${{env.GITHUB_WORKSPACE}} - env: - LD_LIBRARY_PATH: ./external/lib/linux/x86_64/ - OUTPUT: CortexCommand.AppImage - run: | - echo ${LD_LIBRARY_PATH} - ./lindeploy --appdir=build/AppDir --output appimage - - - name: Upload Appimage - uses: actions/upload-artifact@v2 - with: - name: CortexCommand.AppImage - path: CortexCommand.AppImage diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml deleted file mode 100644 index e1009f191..000000000 --- a/.github/workflows/msbuild.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Windows Build - -on: - push: - branches: - - master - - development - - workflow_dispatch: - -env: - # Path to the solution file relative to the root of the project. - SOLUTION_FILE_PATH: RTEA.sln - - # Configuration type to build. - # You can convert this to a build matrix if you need coverage of multiple configuration types. - # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - BUILD_CONFIGURATION: "Final" - -jobs: - build: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 - - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - # Add additional options to the MSBuild command line here (like platform or verbosity level). - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} - - - name: Upload Artifact2 - uses: actions/upload-artifact@v2.2.2 - with: - name: Cortex Command.exe - path: D:/a/Cortex-Command-Community-Project-Source/Cortex-Command-Community-Project-Data/Cortex Command x64.exe - if-no-files-found: warn From 699970c65b299f9fe87414f53f873c9659632e60 Mon Sep 17 00:00:00 2001 From: Stuart Date: Fri, 9 Dec 2022 15:05:58 +1030 Subject: [PATCH 06/17] ci: update & rename `build.yaml` workflow to `release.yaml` This lays the groundwork for a release workflow using Semantic Release. Adds a precursor job to both platform-specific build jobs that determine the release version and set it as a GitHub environment variable. This uses a dry-run of semantic-release with the export plugin. Adds placeholder steps to both workflows to apply this version before building. Updates `actions/checkout` to `@v3` in both build jobs. Adds a new `release` job, dependent on both builds, that publishes a new GitHub release with the built artifacts. Contains placeholder to increment version (so that it can be committed with the new version tag) Calls semantic release to achieve this, config as yet unset. --- .../workflows/{build.yaml => release.yaml} | 80 ++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) rename .github/workflows/{build.yaml => release.yaml} (70%) diff --git a/.github/workflows/build.yaml b/.github/workflows/release.yaml similarity index 70% rename from .github/workflows/build.yaml rename to .github/workflows/release.yaml index 062c15742..6ebadbcde 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Build +name: Build and Release # Controls when the action will run. on: # Triggers the workflow on push to the development or master branches @@ -8,12 +8,38 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: + get-version: + name: Determine new Engine version. + runs-on: ubuntu-latest + + outputs: + new-release-published: ${{ steps.get-next-version.outputs.new-release-published }} + new-release-version: ${{ steps.get-next-version.outputs.new-release-version }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: "npm" + + - name: Install Node Dependencies + run: npm install -g --save-dev semantic-release @semantic-release/git semantic-release-export-data + + - name: Determine version number + id: get-next-version + run: npx semantic-release --dry-run + # This workflow contains a single job called "build" build-release-linux: # The type of runner that the job will run on runs-on: ubuntu-20.04 name: Linux Release Build + needs: get-version # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it @@ -39,6 +65,13 @@ jobs: key: build-release-${{runner.os}} max-size: 5G + ######## + + - name: Set Version + run: echo "version" + + ######## + - name: Build # You may pin to the exact commit or the version. # uses: BSFishy/meson-build@6f1930d878fd3eed3853c1c91285ec604c37f3a5 @@ -93,12 +126,21 @@ jobs: runs-on: windows-latest name: Windows Release Build + needs: get-version + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1 + ######## + + - name: Set Version + run: echo "version" + + ######## + - name: Build working-directory: ${{env.GITHUB_WORKSPACE}} # Add additional options to the MSBuild command line here (like platform or verbosity level). @@ -111,3 +153,37 @@ jobs: name: Cortex Command.exe path: D:/a/Cortex-Command-Community-Project-Source/Cortex-Command-Community-Project-Data/Cortex Command x64.exe if-no-files-found: warn + + release: + name: Publish Release + runs-on: ubuntu-latest + + needs: [build-release-windows, build-release-linux] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: "npm" + + - name: Install Node Dependencies + run: npm install -g --save-dev semantic-release @semantic-release/git semantic-release-export-data + + - name: Download build artefacts + uses: actions/download-artifact@v3 + + - run: ls -R + + ######## + + - name: Set Version + run: echo "version" + + ######## + + - name: Semantic Release + run: npx semantic-release From d4774351b12e7e4594d085344e02bf2128b24bc9 Mon Sep 17 00:00:00 2001 From: Stuart Date: Fri, 9 Dec 2022 16:06:59 +1030 Subject: [PATCH 07/17] ci: game version is set pre-build and release Release workflow uses a regex replace to write the new game version to the `c_GameVersion` variable in `System/Constants/h` Applied pre-build in both jobs, and again to be committed in the release job. --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6ebadbcde..be4da5635 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -68,7 +68,7 @@ jobs: ######## - name: Set Version - run: echo "version" + run: sed -i 's/(c_GameVersion = ")([^"]*)(";)/$1${{${{needs.get-version.outputs.new-release-version}}}}$3/g' ${{env.GITHUB_WORKSPACE}}/System/Constants.h ######## @@ -137,7 +137,7 @@ jobs: ######## - name: Set Version - run: echo "version" + run: sed -i 's/(c_GameVersion = ")([^"]*)(";)/$1${{${{needs.get-version.outputs.new-release-version}}}}$3/g' ${{env.GITHUB_WORKSPACE}}/System/Constants.h ######## @@ -181,7 +181,7 @@ jobs: ######## - name: Set Version - run: echo "version" + run: sed -i 's/(c_GameVersion = ")([^"]*)(";)/$1${{${{needs.get-version.outputs.new-release-version}}}}$3/g' ${{env.GITHUB_WORKSPACE}}/System/Constants.h ######## From 0d3f8932e425b5c3d7ef575d3c7fc1627186447f Mon Sep 17 00:00:00 2001 From: Stuart Date: Sat, 10 Dec 2022 12:17:51 +1030 Subject: [PATCH 08/17] ci: adds semantic-release config file This file specifies the branches to trigger releases on, and required plugins Designates `System/Constants.h` as the committed version file, and all artifacts downloaded to a `release/` dir to be published. --- .releaserc.json | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .releaserc.json diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 000000000..c51966992 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,34 @@ +{ + "branches": [ + "master", + { + "name": "development", + "prerelease": true + } + ], + "repositoryUrl": "https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source", + "debug": "true", + "plugins": [ + "@semantic-release/commit-analyzer", + "semantic-release-export-data", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/git", + { + "assets": [ + "System/Constants.h" + ] + } + ], + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "release/**" + } + ] + } + ] + ] +} \ No newline at end of file From 9b9a25dbc1ff2c697fdb9e2f4e05f1cc2791cb02 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sat, 10 Dec 2022 12:29:20 +1030 Subject: [PATCH 09/17] ci: release artefacts are now downloaded to a temp directory --- .github/workflows/release.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index be4da5635..c80ebd8b3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -173,10 +173,14 @@ jobs: - name: Install Node Dependencies run: npm install -g --save-dev semantic-release @semantic-release/git semantic-release-export-data + - run: mkdir release + - name: Download build artefacts uses: actions/download-artifact@v3 + with: + path: release - - run: ls -R + - run: ls -R release ######## From 7a2b8073e9a9c278a551f4f7ae8a9a1eec1be52d Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:07:11 +1030 Subject: [PATCH 10/17] ci: added concurrency groups to release and CI workflows NOTE: There's a 40-second window during release where cancelling the job will majorly fuck the release & git history. Raise this issue with the team in discussions! --- .github/workflows/ci.yml | 4 ++++ .github/workflows/release.yaml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 008eb6267..8c5453793 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ on: workflow_dispatch: +concurrency: + group: ci-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: build-linux: # The type of runner that the job will run on diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c80ebd8b3..188330f7a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,9 @@ on: branches: [master, development] workflow_dispatch: +concurrency: + group: release-${{ github.ref_name }} + cancel-in-progress: true # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: get-version: From 76f95bff610f83e40eb317627af8a470d26c3ab5 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:11:54 +1030 Subject: [PATCH 11/17] ci: update `actions/checkout` from `v2` -> `v3` --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c5453793..176c2f830 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-python@v2 - name: Install Dependencies @@ -70,7 +70,7 @@ jobs: name: Windows Build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1 From 8a63b0161ad4e16445063c822a64b8d5f8d583c6 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:17:36 +1030 Subject: [PATCH 12/17] ci: fixed version bump script Regex works correctly and works cross-platform thanks to the shell specifier. Remove the unneeded env workspace prefix. Needs to be turned into a GitHub Action. Add `get-version` as a requirement to the `release` job to access its outputs. --- .github/workflows/release.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 188330f7a..8da17b383 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ concurrency: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: get-version: - name: Determine new Engine version. + name: Determine release version. runs-on: ubuntu-latest outputs: @@ -71,7 +71,8 @@ jobs: ######## - name: Set Version - run: sed -i 's/(c_GameVersion = ")([^"]*)(";)/$1${{${{needs.get-version.outputs.new-release-version}}}}$3/g' ${{env.GITHUB_WORKSPACE}}/System/Constants.h + run: sed -i -E "s/(c_GameVersion = \")([^\"]*)(\";)/\1${{needs.get-version.outputs.new-release-version}}\3/g" System/Constants.h + shell: bash ######## @@ -140,7 +141,8 @@ jobs: ######## - name: Set Version - run: sed -i 's/(c_GameVersion = ")([^"]*)(";)/$1${{${{needs.get-version.outputs.new-release-version}}}}$3/g' ${{env.GITHUB_WORKSPACE}}/System/Constants.h + run: sed -i -E "s/(c_GameVersion = \")([^\"]*)(\";)/\1${{needs.get-version.outputs.new-release-version}}\3/g" System/Constants.h + shell: bash ######## @@ -161,7 +163,7 @@ jobs: name: Publish Release runs-on: ubuntu-latest - needs: [build-release-windows, build-release-linux] + needs: [get-version, build-release-windows, build-release-linux] steps: - name: Checkout code @@ -188,7 +190,8 @@ jobs: ######## - name: Set Version - run: sed -i 's/(c_GameVersion = ")([^"]*)(";)/$1${{${{needs.get-version.outputs.new-release-version}}}}$3/g' ${{env.GITHUB_WORKSPACE}}/System/Constants.h + run: sed -i -E "s/(c_GameVersion = \")([^\"]*)(\";)/\1${{needs.get-version.outputs.new-release-version}}\3/g" System/Constants.h + shell: bash ######## From 44827a2975ac12eb060c41159b95532a01150978 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:23:18 +1030 Subject: [PATCH 13/17] ci: explicitly specify node package versions to future-proof The `npm install` command pulls `@latest` by default. By forcing these to use a set version we avoid accidentally pulling a new major version and introducing breaking changes. --- .github/workflows/release.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8da17b383..270ccbc72 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,6 +9,13 @@ on: concurrency: group: release-${{ github.ref_name }} cancel-in-progress: true + +#trigger new dev release again +env: + SEMANTIC_RELEASE_CORE_VERSION: 19 + SEMANTIC_RELEASE_EXPORT_VERSION: 1 + SEMANTIC_RELEASE_GIT_VERSION: 10 + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: get-version: @@ -30,7 +37,7 @@ jobs: cache: "npm" - name: Install Node Dependencies - run: npm install -g --save-dev semantic-release @semantic-release/git semantic-release-export-data + run: npm install -g --save-dev semantic-release@${{env.SEMANTIC_RELEASE_CORE_VERSION}} @semantic-release/git@${{env.SEMANTIC_RELEASE_GIT_VERSION}} semantic-release-export-data@${{env.SEMANTIC_RELEASE_EXPORT_VERSION}} - name: Determine version number id: get-next-version @@ -176,7 +183,7 @@ jobs: cache: "npm" - name: Install Node Dependencies - run: npm install -g --save-dev semantic-release @semantic-release/git semantic-release-export-data + run: npm install -g --save-dev semantic-release@${{env.SEMANTIC_RELEASE_CORE_VERSION}} @semantic-release/git@${{env.SEMANTIC_RELEASE_GIT_VERSION}} semantic-release-export-data@${{env.SEMANTIC_RELEASE_EXPORT_VERSION}} - run: mkdir release From 124fdd3489f503ed154ca217e8331701cb6e836f Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:24:09 +1030 Subject: [PATCH 14/17] ci: disabled npm cache as we're missing a lockfile anyway --- .github/workflows/release.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 270ccbc72..5ba8b0724 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -34,7 +34,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16 - cache: "npm" - name: Install Node Dependencies run: npm install -g --save-dev semantic-release@${{env.SEMANTIC_RELEASE_CORE_VERSION}} @semantic-release/git@${{env.SEMANTIC_RELEASE_GIT_VERSION}} semantic-release-export-data@${{env.SEMANTIC_RELEASE_EXPORT_VERSION}} @@ -180,7 +179,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16 - cache: "npm" - name: Install Node Dependencies run: npm install -g --save-dev semantic-release@${{env.SEMANTIC_RELEASE_CORE_VERSION}} @semantic-release/git@${{env.SEMANTIC_RELEASE_GIT_VERSION}} semantic-release-export-data@${{env.SEMANTIC_RELEASE_EXPORT_VERSION}} From 689f7eb73b7e51ac879d9e91fd453584b81ae43e Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:29:19 +1030 Subject: [PATCH 15/17] ci: add missing GitHub tokens to the environment variables Note: This adds it to all jobs in the workflow, maybe revise it to only target steps in the jobs that require them. --- .github/workflows/release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5ba8b0724..d11bf3e8f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,6 +12,8 @@ concurrency: #trigger new dev release again env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SEMANTIC_RELEASE_CORE_VERSION: 19 SEMANTIC_RELEASE_EXPORT_VERSION: 1 SEMANTIC_RELEASE_GIT_VERSION: 10 From 4c388ec7cfb8180f8aedc8a691a095d0f53af83e Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:33:55 +1030 Subject: [PATCH 16/17] ci: build and release jobs only run if a new release needs publishing Add conditional execution to jobs following the one that determines the new version, so they are discarded from the queue if not needed. --- .github/workflows/release.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d11bf3e8f..0b52e72ff 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,6 +44,10 @@ jobs: id: get-next-version run: npx semantic-release --dry-run + - run: echo "Does a new version need to be published? ${{steps.get-next-version.outputs.new-release-published}}" + - if: steps.get-next-version.outputs.new-release-published == 'true' + run: echo "The new release version is ${{ needs.get-next-version.outputs.new-release-version }}" + # This workflow contains a single job called "build" build-release-linux: # The type of runner that the job will run on @@ -51,6 +55,8 @@ jobs: name: Linux Release Build needs: get-version + if: needs.get-version.outputs.new-release-published == 'true' + # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it @@ -139,6 +145,7 @@ jobs: name: Windows Release Build needs: get-version + if: needs.get-version.outputs.new-release-published == 'true' steps: - uses: actions/checkout@v3 From 6d4d79b0bf3251f0ae71b0e1a440b643ac658d5c Mon Sep 17 00:00:00 2001 From: Stuart Date: Sun, 11 Dec 2022 22:35:21 +1030 Subject: [PATCH 17/17] ci: fix tag prefix and disable release comments Update the `.releaserc.json` file to match current prerelease tagging. Disable release comments on issues / failed build issues triggered by publishing a new release. --- .releaserc.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.releaserc.json b/.releaserc.json index c51966992..9a2d3c7f9 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -3,7 +3,7 @@ "master", { "name": "development", - "prerelease": true + "prerelease": "pre" } ], "repositoryUrl": "https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source", @@ -27,7 +27,12 @@ { "path": "release/**" } - ] + ], + "successComment": false, + "failComment": false, + "failTitle": false, + "releasedLabels": false, + "labels": false } ] ]