Skip to content

Fix startup button

Fix startup button #10

Workflow file for this run

name: Build and Release
# Builds standalone executables for Windows, macOS, and Linux whenever a
# version tag (e.g. v1.0.2) is pushed, then publishes them to a GitHub Release.
# You can also run it manually from the Actions tab via workflow_dispatch.
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
artifact_name: iNat-Seasonal-Visualizer-Windows
asset_glob: dist/iNat-Seasonal-Visualizer-Windows.zip
- os: macos-14
artifact_name: iNat-Seasonal-Visualizer-macOS-Apple-Silicon
asset_glob: dist/iNat-Seasonal-Visualizer-macOS-Apple-Silicon.zip
archive_name: iNat-Seasonal-Visualizer-macOS-Apple-Silicon.zip
expected_arch: arm64
- os: macos-15-intel
artifact_name: iNat-Seasonal-Visualizer-macOS-Intel
asset_glob: dist/iNat-Seasonal-Visualizer-macOS-Intel.zip
archive_name: iNat-Seasonal-Visualizer-macOS-Intel.zip
expected_arch: x86_64
- os: ubuntu-latest
artifact_name: iNat-Seasonal-Visualizer-Linux
asset_glob: dist/iNat-Seasonal-Visualizer-Linux.tar.gz
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Verify release tag matches application version
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
app_version="$(python -c 'from inat_visualizer_version import __version__; print(__version__)')"
if [ "$GITHUB_REF_NAME" != "v$app_version" ]; then
echo "Tag $GITHUB_REF_NAME does not match application version v$app_version"
exit 1
fi
- name: Install system libraries (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libxcb-cursor0 libxkbcommon-x11-0 \
libegl1 libgl1 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller==6.21.0
- name: Verify dependency compatibility
run: |
python -c "from requests_ratelimiter import BucketFullException; import pyinaturalist"
- name: Build executable
shell: bash
run: |
platform_options=()
if [ "$RUNNER_OS" = "macOS" ]; then
platform_options+=(
--osx-bundle-identifier "io.github.alanrockefeller.inat-seasonal-visualizer"
)
elif [ "$RUNNER_OS" = "Windows" ]; then
platform_options+=(--version-file "windows_version_info.txt")
fi
pyinstaller --noconfirm --clean \
--name "iNat-Seasonal-Visualizer" \
--onedir --windowed \
--add-data "splash_screen.jpg${{ runner.os == 'Windows' && ';' || ':' }}." \
--collect-all pyinaturalist \
--collect-submodules duckdb \
"${platform_options[@]}" \
visualizer.py
- name: Set and verify macOS bundle metadata
if: runner.os == 'macOS'
shell: bash
run: |
app_path="dist/iNat-Seasonal-Visualizer.app"
plist_path="$app_path/Contents/Info.plist"
app_version="$(python -c 'from inat_visualizer_version import __version__; print(__version__)')"
plutil -replace CFBundleShortVersionString -string "$app_version" "$plist_path"
if plutil -extract CFBundleVersion raw "$plist_path" >/dev/null 2>&1; then
plutil -replace CFBundleVersion -string "$app_version" "$plist_path"
else
plutil -insert CFBundleVersion -string "$app_version" "$plist_path"
fi
codesign --force --deep --sign - "$app_path"
codesign --verify --deep --strict --verbose=2 "$app_path"
- name: Smoke-test packaged application
shell: bash
env:
QT_QPA_PLATFORM: offscreen
run: |
if [ "$RUNNER_OS" = "macOS" ]; then
executable="dist/iNat-Seasonal-Visualizer.app/Contents/MacOS/iNat-Seasonal-Visualizer"
file_output="$(file "$executable")"
echo "$file_output"
echo "$file_output" | grep -q "${{ matrix.expected_arch }}"
"$executable" --smoke-test
elif [ "$RUNNER_OS" = "Windows" ]; then
./dist/iNat-Seasonal-Visualizer/iNat-Seasonal-Visualizer.exe --smoke-test
else
./dist/iNat-Seasonal-Visualizer/iNat-Seasonal-Visualizer --smoke-test
fi
- name: Package Windows app
if: runner.os == 'Windows'
shell: pwsh
run: >-
Compress-Archive -Path "dist/iNat-Seasonal-Visualizer"
-DestinationPath "dist/iNat-Seasonal-Visualizer-Windows.zip"
- name: Package macOS app
if: runner.os == 'macOS'
run: |
cd dist
archive_name="${{ matrix.archive_name }}"
# ditto preserves the app bundle metadata and executable permissions.
ditto -c -k --keepParent "iNat-Seasonal-Visualizer.app" "$archive_name"
- name: Package Linux binary
if: runner.os == 'Linux'
run: |
cd dist
tar -czf "iNat-Seasonal-Visualizer-Linux.tar.gz" "iNat-Seasonal-Visualizer"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.asset_glob }}
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish release
uses: softprops/action-gh-release@v3
with:
files: artifacts/**/*
generate_release_notes: true
body_path: INSTALL.md