Skip to content

Commit

Permalink
macOS: Add a release action to ci.yml
Browse files Browse the repository at this point in the history
- I had to delete use of ${CONFIGURATION} from the macOS xib handling which seems to be set on the CI environment, but not locally for me.
  • Loading branch information
dpt committed Apr 20, 2022
1 parent a9d2315 commit a04a2a4
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 10 deletions.
93 changes: 85 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,29 @@ on:
# branches: ["*"]

jobs:
##
## Windows
##

windows-cmake-build:
runs-on: windows-latest
steps:
- name: get-cmake
uses: lukka/[email protected]

- uses: actions/checkout@v2

- name: Compile The Great Escape for Windows (via CMake)
run: |
cmake -E make_directory ${{github.workspace}}\build
cd ${{github.workspace}}\build
cmake ${{github.workspace}}
cmake --build .
##
## macOS
##

macos-build:
runs-on: macos-10.15
steps:
Expand All @@ -41,18 +49,86 @@ jobs:

macos-cmake-build:
runs-on: macos-10.15

outputs:
version: ${{ steps.version.outputs.version }}
leafname: ${{ steps.version.outputs.leafname }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: get-cmake
uses: lukka/[email protected]

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Compile The Great Escape for macOS (via CMake)
run: |
mkdir -p build && cd build
cmake -GNinja ..
mkdir -p ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake -GNinja ${{github.workspace}}
cmake --build .
- name: Give the output a versioned name
id: version
run: |
version=$(git rev-parse --short HEAD)
echo "This is version: $version"
leafname="TheGreatEscape-$version-macOS.zip"
echo "::set-output name=version::$version"
echo "::set-output name=leafname::$leafname"
- name: Archive it
run: |
cd ${{github.workspace}}/build/platform/osx
zip -9r ${{ steps.version.outputs.leafname }} TheGreatEscape.app
- uses: actions/upload-artifact@v3
with:
name: The-Great-Escape-macOS
path: ${{github.workspace}}/build/platform/osx/${{ steps.version.outputs.leafname }}
if-no-files-found: error

# The release only triggers when the thing that was pushed was a tag starting with 'macos-'
macos-release:
needs: macos-cmake-build
runs-on: macos-10.15
if: startsWith(github.ref, 'refs/tags/macos-')
steps:
- name: Download built binary
uses: actions/download-artifact@v1
with:
name: The-Great-Escape-macOS

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ needs.macos-cmake-build.outputs.version }}
draft: true
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: The-Great-Escape-macOS/${{ needs.macos-cmake-build.outputs.leafname }}
asset_name: ${{ needs.macos-cmake-build.outputs.leafname }}
asset_content_type: application/zip

##
## RISC OS
##

riscos-build:
# The type of runner that the job will run on
container: riscosdotinfo/riscos-gccsdk-4.7:latest
Expand Down Expand Up @@ -83,7 +159,7 @@ jobs:
version=$(git rev-parse --short HEAD)
fi
echo "This is version: $version"
leafname="TheGreatEscape-$version.zip"
leafname="TheGreatEscape-$version-RISC_OS.zip"
echo "::set-output name=version::$version"
echo "::set-output name=leafname::$leafname"
Expand All @@ -96,10 +172,11 @@ jobs:
find . -type f -not -name '*,*' -exec mv '{}' '{},fff' \; # ensure that type-less files come out as Text
python3 -m rozipfile --verbose --create ../../${{ steps.version.outputs.leafname }} *
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: The-Great-Escape
name: The-Great-Escape-RISC_OS
path: ${{ steps.version.outputs.leafname }}
if-no-files-found: error
# The artifact that is downloadable from the Actions is actually a zip of the artifacts
# that we supply. So it will be a regular Zip file containing a RISC OS Zip file.

Expand All @@ -112,7 +189,7 @@ jobs:
- name: Download built binary
uses: actions/download-artifact@v1
with:
name: The-Great-Escape
name: The-Great-Escape-RISC_OS

- name: Create Release
id: create_release
Expand All @@ -132,7 +209,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: The-Great-Escape/${{ needs.riscos-build.outputs.leafname }}
asset_name: ${{ needs.riscos-build.outputs.leafname }}
Expand Down
4 changes: 2 additions & 2 deletions platform/osx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ add_custom_command(
# Make sure the 'Resources' directory is correctly created before we build
add_custom_command(TARGET TheGreatEscapeApp
PRE_BUILD
COMMAND mkdir -p ./\${CONFIGURATION}/TheGreatEscape.app/Contents/Resources)
COMMAND mkdir -p ./TheGreatEscape.app/Contents/Resources)

# Place resource files in Resources/*
set_source_files_properties(${RESOURCES}
Expand All @@ -118,6 +118,6 @@ foreach(xib ${XIBS})
COMMAND ${IBTOOL}
--errors --warnings --notices
--output-format human-readable-text
--compile ./\${CONFIGURATION}/TheGreatEscape.app/Contents/Resources/${xib}.nib ${RESOURCES_SOURCE_DIR}/${xib}.xib
--compile ./TheGreatEscape.app/Contents/Resources/${xib}.nib ${RESOURCES_SOURCE_DIR}/${xib}.xib
COMMENT "Compiling ${xib}.xib")
endforeach()

0 comments on commit a04a2a4

Please sign in to comment.