Skip to content

Build on GHA

Build on GHA #5

name: Xcode - Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
name: Build Release configuration
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Default Scheme
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
- name: Build
env:
scheme: ${{ 'default' }}
run: |
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild clean build -scheme "$scheme" -configuration "Release" -destination "generic/platform=macOS,name=Any Mac" -"$filetype_parameter" "$file_to_build" BUILD_DIR="${PWD}/artifacts" | xcpretty && exit ${PIPESTATUS[0]}
- name: Zip
run: |
pushd artifacts/
zip -9Xr FlyingJavabo.zip Release
popd
- name: Archive
uses: actions/upload-artifact@v3
with:
name: binary
path: artifacts/FlyingJavabo.zip