Skip to content

Release

Release #151

Workflow file for this run

name: Release
on:
workflow_dispatch:
# push:
# branches:
# - master
env:
TWINE_REPOSITORY_URL: "${{ secrets.TWINE_REPOSITORY_URL }}"
TWINE_USERNAME: "${{ secrets.TWINE_USERNAME }}"
TWINE_PASSWORD: "${{ secrets.TWINE_PASSWORD }}"
FD_BUILD_DIR: ${{ github.workspace }}/build/osx/Release
FD_BUILD_KEYCHAIN_NAME: ${{ github.workspace }}/build/osx/Release/build.keychain-db
FD_BUILD_PROVISIONING_PROFILE_FPATH: ${{ github.workspace }}/build/osx/Release/FD.provisionprofile
FD_BUILD_CERTIFICATE_FPATH: ${{ github.workspace }}/build/osx/Release/FD_certificate.crt
FD_BUILD_PRIVATE_KEY_FPATH: ${{ github.workspace }}/build/osx/Release/FD_certificate.pem
FD_BUILD_AC_AUTH_KEY_FPATH: ${{ github.workspace }}/build/osx/Release/AuthKey_${{ secrets.FD_BUILD_AC_AUTH_KEY_ID }}.p8
FD_APP_PATH: ${{ github.workspace }}/build/osx/Release/Family\ Diagram.app
FD_BUILD_APPLE_ID: "${{ secrets.FD_BUILD_APPLE_ID }}"
FD_BUILD_APPLE_ID_PASSWORD: "${{ secrets.FD_BUILD_APPLE_ID_PASSWORD }}"
FD_BUILD_PROVISIONING_PROFILE_BASE64: "${{ secrets.FD_BUILD_PROVISIONING_PROFILE_BASE64 }}"
FD_BUILD_CERTIFICATE_BASE64: "${{ secrets.FD_BUILD_CERTIFICATE_BASE64 }}"
FD_BUILD_PRIVATE_KEY_BASE64: "${{ secrets.FD_BUILD_PRIVATE_KEY_BASE64 }}"
FD_BUILD_CERTIFICATE_PASSWORD: "${{ secrets.FD_BUILD_CERTIFICATE_PASSWORD }}"
FD_BUILD_AC_AUTH_KEY_ID: "${{ secrets.FD_BUILD_AC_AUTH_KEY_ID }}"
FD_BUILD_AC_AUTH_KEY_BASE64: "${{ secrets.FD_BUILD_AC_AUTH_KEY_BASE64 }}"
FD_BUILD_AC_AUTH_KEY_ISSUER: "${{ secrets.FD_BUILD_AC_AUTH_KEY_ISSUER }}"
FD_BUILD_PEPPER: "${{ secrets.FD_BUILD_PEPPER }}"
FD_BUILD_BUGSNAG_API_KEY: "${{ secrets.FD_BUILD_BUGSNAG_API_KEY }}"
FD_BUILD_MIXPANEL_PROJECT_ID: "${{ secrets.FD_BUILD_MIXPANEL_PROJECT_ID }}"
FD_BUILD_MIXPANEL_PROJECT_TOKEN: "${{ secrets.FD_BUILD_MIXPANEL_PROJECT_TOKEN }}"
FD_BUILD_DATADOG_API_KEY: "${{ secrets.FD_BUILD_DATADOG_API_KEY }}"
jobs:
setup:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Get Version
id: get-version
run: |
echo "version=`python -c "import sys; sys.path.insert(0, './pkdiagram'); import version; print(version.VERSION)"`" >> $GITHUB_OUTPUT
build-osx:
# x86 w/ python-3.12.5
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
runs-on: macos-13
needs: [setup]
steps:
# # Will provide an SSH command in the logs that you can use to access the runner.
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.6
- name: Set up virtual env
run: |
pip install pipenv
mkdir .venv
pipenv --clear
pipenv install --dev
# It is faster to install homebrew than to restore from cache
- name: brew install qt@5 create-dmg
run: |
brew install qt@5 create-dmg
## App
- name: Setup _pkdiagram caching
id: cache-_pkdiagram
uses: actions/cache@v4
with:
path: |
_pkdiagram/build
key: _pkdiagram-${{ runner.os }}-${{ hashFiles('./_pkdiagram/sip/*.sip', './_pkdiagram/*.h', './_pkdiagram/*.cpp') }}-3.11.6
- name: sip-build for _pkdiagram
if: steps.cache-_pkdiagram.outputs.cache-hit != 'true'
run: |
export PATH="/usr/local/opt/qt@5/bin:${PATH}"
which qmake
cd _pkdiagram
pipenv run sip-build --no-compile
moc -o build/_pkdiagram/moc_unsafearea.cpp unsafearea.h
moc -o build/_pkdiagram/moc__pkdiagram.cpp _pkdiagram.h
- name: Download zlib source
run: |
wget -L "https://www.zlib.net/fossils/zlib-1.2.11.tar.gz" -P ./sysroot/
- name: Setup sysroot caching
id: cache-sysroot
uses: actions/cache@v4
with:
path: ./sysroot/sysroot-macos-64
key: sysroot-macos-64-5.15.16--3.11.6
# key: sysroot-${{ runner.os }}-${{ hashFiles('./sysroot/sysroot.toml') }}
# # Will provide an SSH command in the logs that you can use to access the runner.
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Build sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true'
run: |
export PATH="/usr/local/opt/qt@5/bin:${PATH}"
# mkdir -p ~/.pyqtdeploy/cache
wget -L "https://download.qt.io/official_releases/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz" -O sysroot/qt-everywhere-src-5.15.16.tar.xz
wget https://files.pythonhosted.org/packages/0e/07/c9ed0bd428df6f87183fca565a79fee19fa7c88c7f00a7f011ab4379e77a/PyQt5-5.15.11.tar.gz -O sysroot/PyQt5-5.15.11.tar.gz
# https://bugreports.qt.io/browse/QTBUG-117225
# cp sysroot/toolchain-macos-13.prf sysroot/sysroot-macos-64/build/qt-everywhere-src-5.15.2/qtbase/mkspecs/features/toolchain.prf
pipenv run pyqtdeploy-sysroot --target macos-64 --verbose sysroot/sysroot.toml
- uses: actions/cache/save@v4
if: steps.cache-sysroot.outputs.cache-hit != 'true'
with:
path: ./sysroot/sysroot-macos-64
key: sysroot-macos-64-5.15.16--3.11.6
- name: Write build config
run: |
export PATH="`pwd`/sysroot/sysroot-macos-64/Qt/bin:${PATH}"
pipenv run python bin/update_build_info.py
pipenv run pyqtdeploy-build --verbose --resources 12 --target macos-64 --build-dir build/osx familydiagram.pdt
rsync -avzq build/common-config/* build/osx
rsync -avzq build/osx-config/* build/osx
- name: qmake
run: |
export PATH="`pwd`/sysroot/sysroot-macos-64/Qt/bin:${PATH}"
cd build/osx
qmake -spec macx-xcode CONFIG+=no_autoqmake CONFIG+=debug CONFIG-=release CONFIG+=beta
- name: Setup provisioning profile
run: |
pipenv run ./bin/setup_provisioning_profile.sh
- name: Update xcode project to new build system
run: |
python3 bin/fixup_xcodeproj_workspace.py
- name: Qt Preprocess
run: |
xcodebuild \
-project build/osx/Family\ Diagram.xcodeproj \
-target "Qt Preprocess" \
-configuration Release
- name: Build App
run: |
pipenv run xcodebuild \
-project build/osx/Family\ Diagram.xcodeproj \
-scheme "Family Diagram" \
-configuration Release \
-archivePath ${FD_BUILD_DIR}/Family\ Diagram.xcarchive \
-xcconfig build/osx/Family-Diagram-Release.xcconfig \
archive
- name: Export archive
run: |
xcodebuild \
-verbose \
-exportArchive \
-archivePath ${FD_BUILD_DIR}/Family\ Diagram.xcarchive \
-exportOptionsPlist build/osx/ExportOptions.plist \
-exportPath $FD_BUILD_DIR/Export
- name: Verify app
run: |
build/osx/Release/Export/Family\ Diagram.app/Contents/MacOS/Family\ Diagram --version
- name: Prep App Bundle
run: |
rm build/osx/Release/Family\ Diagram.app # symlink
cp -R $FD_BUILD_DIR/Export/Family\ Diagram.app build/osx/Release
ditto -c -k --keepParent \
"$FD_BUILD_DIR/Family Diagram.app" \
"$FD_BUILD_DIR/Family Diagram.zip"
- name: Uploading for notarization
run: |
xcrun notarytool submit \
--key "${FD_BUILD_AC_AUTH_KEY_FPATH}" \
--key-id "${FD_BUILD_AC_AUTH_KEY_ID}" \
--issuer "${FD_BUILD_AC_AUTH_KEY_ISSUER}" \
--timeout 2h \
--wait --progress \
--output-format plist \
"$FD_BUILD_DIR/Family Diagram.zip" \
> ${FD_BUILD_DIR}/NotaryResults.plist || true
REQUEST_STATUS=$(/usr/libexec/PlistBuddy -c "Print :status" build/osx/Release/NotaryResults.plist)
if [ "$REQUEST_STATUS" != "Accepted" ]; then
REQUEST_UUID=$(/usr/libexec/PlistBuddy -c "Print :id" ${FD_BUILD_DIR}/NotaryResults.plist)
echo "PKS *** Notarizing failed, fetching developer log for Request ID: ${REQUEST_UUID}..."
xcrun notarytool log $REQUEST_UUID \
--key "${FD_BUILD_AC_AUTH_KEY_FPATH}" \
--key-id "${FD_BUILD_AC_AUTH_KEY_ID}" \
--issuer "${FD_BUILD_AC_AUTH_KEY_ISSUER}"
exit 1
fi
- name: Stapling app bundle
run: |
xcrun stapler staple "${FD_BUILD_DIR}/Family Diagram.app"
- name: Unmount existing DMG
run: |
hdiutil detach /Volumes/"Family Diagram" || true
- name: Create DMG
run: |
cd build/osx
ls -la ./Release
hdiutil info
# copy to a tmp folder to avoid "hdiutil: Resource busy"
mkdir -p /tmp/Family-Diagram/
cp -R ./Release/Family\ Diagram.app /tmp/Family-Diagram/
cp -R ../osx-config/PKDiagram-Filled.icns /tmp/Family-Diagram/
cp -R ../osx-config/DMG-Background.png /tmp/Family-Diagram/
create-dmg \
--volname "Family Diagram" \
--volicon "PKDiagram-Filled.icns" \
--background "DMG-Background.png" \
--window-pos 200 200 \
--window-size 800 600 \
--icon-size 128 \
--icon "Family Diagram.app" 200 350 \
--hide-extension "Family Diagram.app" \
--app-drop-link 600 350 \
--no-internet-enable \
--hdiutil-verbose \
"./Release/Family Diagram.dmg" \
"/tmp/Family-Diagram/"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: familydiagram-macos
path: build/osx/Release/Family Diagram.dmg
build-windows:
runs-on: windows-2019
needs: [setup]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.11.6
uses: actions/setup-python@v5
with:
python-version: 3.11.6
- run: |
pip install pipenv
mkdir .venv
pipenv --clear
set PIPENV_CACHE_DIR=.\pipenv_cache
pipenv install --dev
- name: Install Qt
run: |
pipenv install aqtinstall
pipenv run aqt install-qt windows desktop 5.15.2 win64_msvc2019_64 --outputdir C:\Qt --archives qtbase qtdeclarative qtgraphicaleffects qtimageformats qtquickcontrols qtquickcontrols2 qttools qtwinextras
- name: Setup _pkdiagram caching
id: cache-_pkdiagram
uses: actions/cache@v4
with:
path: |
_pkdiagram/build
key: _pkdiagram-${{ runner.os }}-${{ hashFiles('./_pkdiagram/sip/*.sip', './_pkdiagram/*.h', './_pkdiagram/*.cpp') }}-3.11.6
- name: sip-build for _pkdiagram
if: steps.cache-_pkdiagram.outputs.cache-hit != 'true'
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PATH=C:\Qt\5.15.2\msvc2019_64\bin;%PATH%
qmake --version
cd _pkdiagram
dir build\_pkdiagram
REM mkdir build\_pkdiagram\release
pipenv run sip-build --no-compile
moc -o build\_pkdiagram\moc_unsafearea.cpp unsafearea.h
moc -o build\_pkdiagram\moc__pkdiagram.cpp _pkdiagram.h
shell: cmd
- name: Setup sysroot caching
id: cache-sysroot
uses: actions/cache@v4
with:
path: sysroot/sysroot-win-64
key: sysroot-win-64-5.15.16--3.11.6
# key: sysroot-${{ runner.os }}-${{ hashFiles('./sysroot/sysroot.toml') }}
# The moc files are required by the sysroot plugin as well as the build plugin
- name: Build sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true'
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PATH=C:\Qt\5.15.2\msvc2019_64\bin;%PATH%
echo "Downloading https://download.qt.io/official_releases/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz"
curl -L "https://download.qt.io/official_releases/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz" -o "sysroot/qt-everywhere-src-5.15.16.tar.xz"
echo "Downloading https://files.pythonhosted.org/packages/0e/07/c9ed0bd428df6f87183fca565a79fee19fa7c88c7f00a7f011ab4379e77a/PyQt5-5.15.11.tar.gz"
curl -L "https://files.pythonhosted.org/packages/0e/07/c9ed0bd428df6f87183fca565a79fee19fa7c88c7f00a7f011ab4379e77a/PyQt5-5.15.11.tar.gz" -o "sysroot/PyQt5-5.15.11.tar.gz"
REM powershell -Command "Invoke-WebRequest 'https://download.qt.io/official_releases/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz' -OutFile 'sysroot/qt-everywhere-src-5.15.16.tar.xz'"
REM powershell -Command "Invoke-WebRequest 'https://files.pythonhosted.org/packages/0e/07/c9ed0bd428df6f87183fca565a79fee19fa7c88c7f00a7f011ab4379e77a/PyQt5-5.15.11.tar.gz' -OutFile 'sysroot/PyQt5-5.15.11.tar.gz'"
cd _pkdiagram
dir build\_pkdiagram
REM mkdir build\_pkdiagram
moc -o build\_pkdiagram\moc_unsafearea.cpp unsafearea.h
moc -o build\_pkdiagram\moc__pkdiagram.cpp _pkdiagram.h
cd ..
pipenv run pip list
pipenv run pyqtdeploy-sysroot --verbose sysroot/sysroot.toml
shell: cmd
- uses: actions/cache/save@v4
if: steps.cache-sysroot.outputs.cache-hit != 'true'
with:
path: sysroot/sysroot-win-64
key: sysroot-win-64-5.15.16--3.11.6
- name: Write build config
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
pipenv run python bin\update_build_info.py
shell: cmd
# Write these in case sysroot-build did not run
- name: (Re-)write _pkdiagram moc files
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd _pkdiagram
set PATH=C:\Qt\5.15.2\msvc2019_64\bin;%PATH%
REM if not exist build\_pkdiagram\moc_unsafearea.cpp (
REM mkdir build\_pkdiagram
REM )
if not exist build\_pkdiagram\moc_unsafearea.cpp (
moc -o build\_pkdiagram\moc_unsafearea.cpp unsafearea.h
)
if not exist build\_pkdiagram\moc__pkdiagram.cpp (
moc -o build\_pkdiagram\moc__pkdiagram.cpp _pkdiagram.h
)
shell: cmd
- name: pyqtdeploy-build
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PYTHONPATH=%cd%\lib\site-packages
pipenv run pyqtdeploy-build --verbose --resources 12 --build-dir build\\win32 --target win-64 familydiagram.pdt
copy build\common-config\* build\win32\
copy build\win32-config\* build\win32\
shell: cmd
- name: qmake
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PATH=%cd%\sysroot\sysroot-win-64\Qt\bin;%PATH%
cd build\win32
qmake -tp vc "CONFIG-=debug" "CONFIG+=release" "CONFIG+=beta"
shell: cmd # has to be shell or qmake won't work
- name: Build
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
echo on
cd build\win32
msbuild /p:Configuration=Release "Family Diagram.vcxproj"
shell: cmd
- name: Compress build
run: |
cd build\win32\Release
7z a -tzip "Family Diagram.zip" "Family Diagram.exe"
shell: cmd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: familydiagram-windows
path: build\win32\Release\Family Diagram.zip
publish:
runs-on: ubuntu-24.04
needs: [setup, build-osx, build-windows]
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.version }}
release_name: ${{ needs.setup.outputs.version }}
draft: false
prerelease: false
- name: Upload macOS Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: familydiagram-macos/Family Diagram.dmg
# asset_name: Family Diagram ${{ needs.setup.outputs.version }}.dmg
asset_name: Family Diagram.dmg
asset_content_type: application/x-apple-diskimage
- name: Upload Windows Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: familydiagram-windows/Family Diagram.zip
# asset_name: Family Diagram ${{ needs.setup.outputs.version }}.zip
asset_name: Family Diagram.zip
asset_content_type: application/zip
update-appcast:
runs-on: ubuntu-24.04
needs: publish
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Generate Sparkle appcast xml
run: |
python bin/github_releases_2_appcast.py
- name: Push appcast.xml to familydiagram.com/appcast.xml
env:
FAMILYDIAGRAM_COM_SSH_PRIVATE_KEY: ${{ secrets.FAMILYDIAGRAM_COM_SSH_PRIVATE_KEY }}
run: |
echo "${FAMILYDIAGRAM_COM_SSH_PRIVATE_KEY}" > private_key
chmod 600 private_key
mkdir -p ~/.ssh
ssh-keyscan -H familydiagram.com >> ~/.ssh/known_hosts
scp -i private_key *.xml patrick@familydiagram.com:/var/www/html/
rm private_key