Build PyInstaller artifacts (Release) #5
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: Build PyInstaller artifacts (Release) | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
pyinstaller: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- name: Mac OS | |
os: macos-latest | |
dist_file_name: betty.app | |
dist_file_description: Mac OS desktop application | |
- name: Windows | |
os: windows-latest | |
dist_file_description: Windows desktop application | |
steps: | |
- name: Check out the source code | |
uses: actions/checkout@v3 | |
- name: Get the pip cache directory | |
run: echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_ENV | |
shell: bash | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.pip_cache_dir }} | |
key: pip-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('./setup.py') }} | |
restore-keys: | | |
pip-${{ runner.os }}-${{ matrix.python }}- | |
- name: Get the npm cache directory | |
run: echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_ENV | |
shell: bash | |
- name: Cache npm | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.npm_cache_dir }} | |
key: npm-${{ runner.os }}-${{ hashFiles('./package.json') }} | |
restore-keys: | | |
npm-${{ runner.os }}- | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Build the executable | |
run: ./bin/build-pyinstaller '${{ github.event.release.tag_name }}' | |
shell: bash | |
- name: Zip the Mac OS executable | |
if: startsWith(runner.os, 'macOS') | |
run: zip -X ./dist/${{ matrix.dist_file_name }}.zip ./dist/${{ matrix.dist_file_name }} | |
shell: bash | |
- name: Zip the Windows executable | |
if: startsWith(runner.os, 'Windows') | |
run: Compress-Archive .\dist\${{ matrix.dist_file_name }} .\dist\${{ matrix.dist_file_name }}.zip | |
- name: Publish the executable | |
run: gh release upload ${{ github.event.release.tag_name }} ./dist/${{ matrix.dist_file_name }}.zip%#%${{ matrix.dist_file_description }} --clobber | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |