Update MacOS build

This commit is contained in:
ReenigneArcher 2022-06-10 23:20:24 -04:00
commit 7a5890469c
4 changed files with 172 additions and 38 deletions

View file

@ -247,7 +247,7 @@ jobs:
build_mac:
name: MacOS
runs-on: macos-11
runs-on: macos-12
needs: check_changelog
steps:
@ -264,12 +264,33 @@ jobs:
# fix openssl header not found
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
# update paths for macports
echo "/opt/local/sbin" >> $GITHUB_PATH
echo "/opt/local/bin" >> $GITHUB_PATH
- name: Build MacOS
run: |
# variables for Portfile
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF}
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch=${GITHUB_BASE_REF}
else
echo "This is a PR event"
fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config ..
cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} ..
make -j ${nproc}
- name: Package MacOS
@ -279,12 +300,69 @@ jobs:
# package
cpack -G DragNDrop
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos-experimental-dragndrop.dmg
cpack -G Bundle
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos-experimental-bundle.dmg
cpack -G ZIP
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos-experimental-archive.zip
# move
mv Portfile ../artifacts/Portfile
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos.dmg
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos.zip
- name: Setup Macports
run : |
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2
tar xf MacPorts-2.7.2.tar.bz2
cd MacPorts-2.7.2
./configure
make
sudo make install
cd ../
rm -rf MacPorts-2.7.2*
# update sources
sudo port -v selfupdate
# use custom sources
sudo chmod 777 /opt/local/etc/macports/sources.conf
echo file://$(echo ~)/ports > /opt/local/etc/macports/sources.conf
echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /opt/local/etc/macports/sources.conf
sudo chmod 644 /opt/local/etc/macports/sources.conf
- name: Package with MacPorts
run: |
# setup custom port
mkdir -p ~/ports/multimedia/sunshine
# copy configured Portfile
cp ./artifacts/Portfile ~/ports/multimedia/sunshine/
# index the ports
cd ~/ports
portindex
# build port
sudo port install sunshine
# || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \
# && exit 1
# create packages
sudo port dmg sunshine
sudo port pkg sunshine
# move
mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg
mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg
# testing only
ls ~/ports/multimedia/sunshine
cat ~/ports/multimedia/sunshine/Portfile
cat /opt/local/etc/macports/sources.conf
cat ~/ports/Portindex
port search sunshine
- name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
@ -293,6 +371,15 @@ jobs:
name: sunshine-macos
path: artifacts/
# this step can be removed after packages are fixed
- name: Delete experimental packages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
working-directory: artifacts
run: |
rm -f ./sunshine-macos-experimental-dragndrop.dmg
rm -f ./sunshine-macos-experimental-bundle.dmg
rm -f ./sunshine-macos-experimental-archive.zip
- name: Create Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: SunshineStream/actions/create_release@master