diff --git a/.github/workflows/build-check.yml b/.github/workflows/ci.yml similarity index 73% rename from .github/workflows/build-check.yml rename to .github/workflows/ci.yml index d933b12b4..176c2f830 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/ci.yml @@ -1,25 +1,25 @@ -name: Compile check +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: +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 runs-on: ubuntu-20.04 - + name: Linux 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/checkout@v3 - uses: actions/setup-python@v2 - name: Install Dependencies @@ -67,16 +67,16 @@ jobs: BUILD_CONFIGURATION: "Final" runs-on: windows-latest + name: Windows Build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + - 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}} 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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..0b52e72ff --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,213 @@ +name: Build and Release +# Controls when the action will run. +on: + # Triggers the workflow on push to the development or master branches + push: + branches: [master, development] + workflow_dispatch: + +concurrency: + group: release-${{ github.ref_name }} + cancel-in-progress: true + +#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 + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + get-version: + name: Determine release 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 + + - 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}} + + - name: Determine version number + 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 + runs-on: ubuntu-20.04 + 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 + - 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: Set Version + run: sed -i -E "s/(c_GameVersion = \")([^\"]*)(\";)/\1${{needs.get-version.outputs.new-release-version}}\3/g" System/Constants.h + shell: bash + + ######## + + - 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@v3 + 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 + + needs: get-version + if: needs.get-version.outputs.new-release-published == 'true' + + steps: + - uses: actions/checkout@v3 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1 + + ######## + + - name: Set Version + run: sed -i -E "s/(c_GameVersion = \")([^\"]*)(\";)/\1${{needs.get-version.outputs.new-release-version}}\3/g" System/Constants.h + shell: bash + + ######## + + - 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 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 + if-no-files-found: warn + + release: + name: Publish Release + runs-on: ubuntu-latest + + needs: [get-version, 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 + + - 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}} + + - run: mkdir release + + - name: Download build artefacts + uses: actions/download-artifact@v3 + with: + path: release + + - run: ls -R release + + ######## + + - name: Set Version + run: sed -i -E "s/(c_GameVersion = \")([^\"]*)(\";)/\1${{needs.get-version.outputs.new-release-version}}\3/g" System/Constants.h + shell: bash + + ######## + + - name: Semantic Release + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 000000000..9a2d3c7f9 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,39 @@ +{ + "branches": [ + "master", + { + "name": "development", + "prerelease": "pre" + } + ], + "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/**" + } + ], + "successComment": false, + "failComment": false, + "failTitle": false, + "releasedLabels": false, + "labels": false + } + ] + ] +} \ No newline at end of file