Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Cf/460 Create a release workflow to publish new source build artefacts #466

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
99541ba
style: renamed `build-check` workflow to Continuous Integration
traunts Dec 5, 2022
352957c
ci: continuous integration now only runs on Pull Requests, not on mer…
traunts Dec 5, 2022
7ffbce1
ci: merge existing patform specific build workflows into one
traunts Dec 5, 2022
ff22db0
ci: updated to actions/upload-artefact@v3
traunts Dec 5, 2022
a7da0db
ci: removed deprecated platform specific build workflows
traunts Dec 6, 2022
9a28515
Merge pull request #463 from cortex-command-community/cf/461-prepare-…
traunts Dec 6, 2022
699970c
ci: update & rename `build.yaml` workflow to `release.yaml`
traunts Dec 9, 2022
d477435
ci: game version is set pre-build and release
traunts Dec 9, 2022
0d3f893
ci: adds semantic-release config file
traunts Dec 10, 2022
9b9a25d
ci: release artefacts are now downloaded to a temp directory
traunts Dec 10, 2022
25f7475
Merge branch 'development' into cf/459-create-a-cd-pipeline-to-automa…
traunts Dec 11, 2022
1a46674
Merge branch 'cf/459-create-a-cd-pipeline-to-automate-project-release…
traunts Dec 11, 2022
7a2b807
ci: added concurrency groups to release and CI workflows
traunts Dec 11, 2022
76f95bf
ci: update `actions/checkout` from `v2` -> `v3`
traunts Dec 11, 2022
8a63b01
ci: fixed version bump script
traunts Dec 11, 2022
44827a2
ci: explicitly specify node package versions to future-proof
traunts Dec 11, 2022
124fdd3
ci: disabled npm cache as we're missing a lockfile anyway
traunts Dec 11, 2022
689f7eb
ci: add missing GitHub tokens to the environment variables
traunts Dec 11, 2022
4c388ec
ci: build and release jobs only run if a new release needs publishing
traunts Dec 11, 2022
6d4d79b
ci: fix tag prefix and disable release comments
traunts Dec 11, 2022
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
34 changes: 17 additions & 17 deletions .github/workflows/build-check.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}}
83 changes: 0 additions & 83 deletions .github/workflows/meson.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/msbuild.yml

This file was deleted.

213 changes: 213 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
Loading