Skip to content
Merged
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
48 changes: 48 additions & 0 deletions .github/actions/bundle_release/action.yaml
Original file line number Diff line number Diff line change
@@ -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





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 Constants.h GameVersion
run: sed -i -E '/c_VersionString = /s/"[^"]*"/"${{inputs.new_release_version}}"/' Source/System/GameVersion.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
27 changes: 0 additions & 27 deletions .github/workflows/master_build.yaml

This file was deleted.

26 changes: 23 additions & 3 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -42,6 +45,9 @@ on:
type: string
required: false
default: "release"
new_release_version:
type: string
required: false

jobs:
build-linux:
Expand All @@ -59,6 +65,13 @@ 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}}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Meson
env:
CC: "gcc"
Expand Down Expand Up @@ -114,7 +127,7 @@ jobs:
build-macos:
runs-on: macos-11
name: MacOS Build

env:
GCC_VERSION: "13"
MACOSX_DEPLOYMENT_TARGET: 10.15
Expand All @@ -124,8 +137,15 @@ 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}}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Meson
env:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -54,6 +59,13 @@ 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}}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
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}}

- name: Bundle release assets
uses: ./.github/actions/bundle_release

- name: Create a new Release
run: |
gh release create v${{ github.event.inputs.new_release_version }} \
--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)' \
'CortexCommand.macos.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (macOS Release)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit and push Version Changes and Update latest tag
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

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": "'"$RELEASE_COMMIT"'",
"ref": "${{ github.ref }}"
}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}