Skip to content

chore(GHA): debugging pyinstaller behavior on macOS #27

chore(GHA): debugging pyinstaller behavior on macOS

chore(GHA): debugging pyinstaller behavior on macOS #27

Workflow file for this run

name: Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
version:
runs-on: 'ubuntu-latest'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checking out the repo
uses: actions/checkout@v4
- name: Figure out version string
id: version
shell: sh
run: |
# get the latest commit hash in the short form
COMMIT=$(git rev-parse --short HEAD)
# get the latest commit date in the form of YYYYmmdd
DATE=$(git log -1 --format=%cd --date=format:'%y%m%d%H%M')
echo "version=${DATE}-${COMMIT}" >> "$GITHUB_OUTPUT"
build:
needs: [version]
# convert this to a matrix if builds differ between platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['macos-latest']
# ['windows-latest', 'ubuntu-latest']
outputs:
version: ${{ needs.version.outputs.version }}
steps:
- name: Checking out the repo
uses: actions/checkout@v4
# see *py_ver* in ci/update.py
- name: Setting up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --progress-bar=off -r requirements.txt
python -m pip install pyinstaller
- name: Build
env:
VERSION: ${{ needs.version.outputs.version }}
shell: sh
run: |
OS=${{ matrix.os }}
#sed -i -e "s/\(name=['\"]\)\([^'\"\.]\+\)\(\(\.[^'\"]\+\)\?['\"],\)/\1\2-$VERSION-${OS%-*}\3/" LiveFT.spec
#cat LiveFT.spec # show result of sed replacement
#pyinstaller LiveFT.spec
pyinstaller --windowed --onedir LiveFT.py
cat LiveFT.spec
- name: Create DMG
if: matrix.os == 'macos-latest'
shell: sh
run: |
cd dist
fn="$(ls -d LiveFT*.app)"; fn="${fn%.*}"
hdiutil create -fs HFS+ -srcfolder "$fn.app" -volname "$fn" "$fn.dmg"
rm -Rf "$fn.app" "$fn"
- name: Store built packages for publishing later
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: dist/*.*
publish:
needs: [build]
runs-on: 'ubuntu-latest'
steps:
- name: Download previuously built package artifacts
uses: actions/download-artifact@v4
with:
pattern: package-*
merge-multiple: true
path: dist
- name: Check contents
run: pwd; ls -la; ls -la dist
- name: Get version string
env:
VERSION: ${{ needs.build.outputs.version }}
run: |
echo "version: '$VERSION'"${{ needs.build.outputs.version }}
- name: Release
uses: softprops/action-gh-release@v2
with:
make_latest: true
draft: false
prerelease: false
tag_name: ${{ needs.build.outputs.version }}
files: dist/*
# publish:
# needs: [build]
# runs-on: 'ubuntu-latest'
# steps:
#
# - name: Checking out the repo
# uses: actions/checkout@v4
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install --progress-bar=off -r ci/requirements.txt
#
# - name: Download package artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: packages-*
# merge-multiple: true
# path: dist
#
# - name: Check generated packages
# run: twine check dist/*.*
#
# - name: Upload packages
# env:
# TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}"
# TWINE_NON_INTERACTIVE: 1
# run: |
# twine upload --disable-progress-bar --skip-existing -u __token__ -r pypi dist/*.*