Version 603 #77
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release-macOS | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-macos: | |
runs-on: macos-13 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- | |
name: Build docs to /help | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade wheel | |
python3 -m pip install mkdocs-material | |
mkdocs build -d help | |
- | |
name: Install PyOxidizer | |
run: python3 -m pip install pyoxidizer==0.24.0 | |
- | |
name: Download ffmpeg | |
run: | | |
cd $GITHUB_WORKSPACE | |
curl -L -o ffmpeg-macos.7z https://evermeet.cx/ffmpeg/getrelease/ffmpeg/7z | |
- | |
name: Process ffmpeg | |
run: | | |
cd $GITHUB_WORKSPACE | |
7z e ffmpeg-macos.7z -obin "ffmpeg" | |
- | |
name: Extract Version Metadata | |
id: meta | |
run: | | |
echo "version=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
echo "version_short=${GITHUB_REF##*/v}" >> $GITHUB_ENV | |
- | |
name: Write version to Info.plist | |
run: | | |
cd $GITHUB_WORKSPACE | |
plutil -replace CFBundleShortVersionString -string "${{ env.version_short }}" static/build_files/macos/Info.plist | |
- | |
name: Build Hydrus | |
run: | | |
cd $GITHUB_WORKSPACE | |
cp static/build_files/macos/pyoxidizer.bzl pyoxidizer.bzl | |
cp static/build_files/macos/requirements.txt requirements.txt | |
basename $(rustc --print sysroot) | sed -e "s/^stable-//" > triple.txt | |
pyoxidizer build --release | |
cd build/$(head -n 1 triple.txt)/release | |
mkdir -p "Hydrus Network.app/Contents/MacOS" | |
mkdir -p "Hydrus Network.app/Contents/Resources" | |
mkdir -p "Hydrus Network.app/Contents/Frameworks" | |
mv install/static/icon.icns "Hydrus Network.app/Contents/Resources/icon.icns" | |
cp install/static/build_files/macos/Info.plist "Hydrus Network.app/Contents/Info.plist" | |
cp install/static/build_files/macos/ReadMeFirst.rtf ./ReadMeFirst.rtf | |
cp install/static/build_files/macos/running_from_app "install/running_from_app" | |
ln -s /Applications ./Applications | |
mv install/* "Hydrus Network.app/Contents/MacOS/" | |
rm -rf install | |
- | |
name: Build DMG | |
run: | | |
cd $GITHUB_WORKSPACE | |
temp_dmg="$(mktemp).dmg" | |
# we are out here | |
# https://github.com/actions/runner-images/issues/7522 | |
# https://github.com/nuttyartist/notes/commit/79170cca1a21929d2d5d33808b8cac02ad58dd7d#diff-7b74d73de878e0e53f6768bbf3a3d4b50c3c6f1f16f9b64518690028b8206b1cR191 | |
max_tries=10 | |
attempt=0 | |
until hdiutil create "$temp_dmg" -ov -volname "HydrusNetwork" -fs HFS+ -format ULFO -srcfolder "$GITHUB_WORKSPACE/build/$(head -n 1 triple.txt)/release" | |
do | |
attempt=$((attempt + 1)) | |
if [ "$attempt" -eq "$max_tries" ]; then | |
echo 'Error: $max_tries attempts at hdiutil did not do it!' | |
exit 1 | |
fi | |
sleep 5 | |
done | |
mv "$temp_dmg" Hydrus.Network.${{ env.version_short }}.-.macOS.-.App.dmg | |
- | |
name: Upload Files | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
Hydrus.Network.${{ env.version_short }}.-.macOS.-.App.dmg |