Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/actions/set_version/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Set Version'
description: 'Updates all references to the current game version'
inputs:
new_release_version:
description: 'The new version string'
required: true
runs:
using: "composite"
steps:
- name: Set GameVersion.h GameVersion
run: sed -i -E '/c_VersionString = /s/"[^"]*"/"${{inputs.new_release_version}}"/' System/GameVersion.h
shell: bash

- uses: actions/setup-python@v3

- name: Rewrite meson version
run: |
pip install meson==0.60.3
meson rewrite kwargs set project // version ${{ inputs.new_release_version }}
shell: bash
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ concurrency:
jobs:
meson:
uses: ./.github/workflows/meson.yml

msbuild:
uses: ./.github/workflows/msbuild.yml

8 changes: 3 additions & 5 deletions .github/workflows/master_build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Master Build

on:
Expand All @@ -17,11 +16,10 @@ concurrency:
jobs:
meson:
uses: ./.github/workflows/meson.yml
with:
upload_artefacts: true
with:
upload_artefacts: true

msbuild:
uses: ./.github/workflows/msbuild.yml
with:
upload_artefacts: true

upload_artefacts: true
15 changes: 12 additions & 3 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ on:
type: string
required: false
default: "release"
new_release_version:
type: string
required: false

jobs:
build-linux:
Expand All @@ -66,6 +69,12 @@ jobs:
run: |
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} -Db_lto=true build

- name: Set Version
if: ${{inputs.new_release_version}}
uses: ./.github/actions/set_version
with:
new_release_version: ${{inputs.new_release_version}}

- name: Configure for AppImage
if: ${{inputs.upload_artefacts}}
env:
Expand Down Expand Up @@ -114,7 +123,7 @@ jobs:
build-macos:
runs-on: macos-11
name: MacOS Build

env:
GCC_VERSION: "13"
MACOSX_DEPLOYMENT_TARGET: 10.15
Expand All @@ -124,8 +133,8 @@ jobs:

- name: "Install Dependencies"
uses: melusina-org/setup-macports@v1
with:
parameters: ".github/parameters/macports.yml"
with:
parameters: ".github/parameters/macports.yml"

- name: Setup Meson
env:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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.
Expand All @@ -54,6 +57,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).
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
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 ${{ steps.get-next-version.outputs.new-release-version }}"

build-meson-releases:
name: Linux & macOS Release Builds

needs: get-version
if: needs.get-version.outputs.new-release-published == 'true'

uses: ./.github/workflows/meson.yml
with:
new_release_version: ${{needs.get-version.outputs.new-release-version}}
upload_artefacts: true

build-msbuild-releases:
name: Windows Release Build

needs: get-version
if: needs.get-version.outputs.new-release-published == 'true'

uses: ./.github/workflows/msbuild.yml
with:
new_release_version: ${{needs.get-version.outputs.new-release-version}}
upload_artefacts: true

release:
name: Publish Release
runs-on: ubuntu-latest

needs: [get-version, build-msbuild-releases, build-meson-releases]

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
uses: ./.github/actions/set_version
with:
new_release_version: ${{needs.get-version.outputs.new-release-version}}

- name: Compress Windows Release
run: |
zip -j CortexCommand.windows.zip \
"release/Cortex Command.exe" \
external/lib/win/{fmod,SDL2}.dll

- name: Compress Linux Release
run: |
zip -j CortexCommand.linux.zip \
"release/CortexCommand (Linux)/CortexCommand.AppImage" \
external/lib/linux/x86_64/libfmod.so*

- name: Compress OSX Release
run: |
zip -j CortexCommand.macos.zip \
"release/CortexCommand (macOS)/CortexCommand" \
external/lib/macos/libfmod.dylib

- name: Package Data files
run: |
zip -r -u CortexCommand.windows.zip Data
zip -r -u CortexCommand.linux.zip Data
zip -r -u CortexCommand.macos.zip Data

- name: Semantic Release
run: npx semantic-release
53 changes: 53 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"branches": [
"master",
{
"name": "development",
"prerelease": "pre"
}
],
"repositoryUrl": "https://github.com/cortex-command-community/Cortex-Command-Community-Project",
"debug": "true",
"plugins": [
"@semantic-release/commit-analyzer",
"semantic-release-export-data",
[
"@semantic-release/release-notes-generator",
{
"writerOpts": {
"commitsSort": ["scope", "header"]
}
}
],
[
"@semantic-release/git",
{
"assets": ["System/GameVersion.h", "meson.build"]
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "CortexCommand.windows.zip",
"label": "Cortex Command v${nextRelease.version} (Windows Release)"
},
{
"path": "CortexCommand.linux.zip",
"label": "Cortex Command v${nextRelease.version} (Linux Release)"
},
{
"path": "CortexCommand.macos.zip",
"label": "Cortex Command v${nextRelease.version} (macOS Release)"
}
],
"successComment": false,
"failComment": false,
"failTitle": false,
"releasedLabels": false,
"labels": false
}
]
]
}