Skip to content

Build PyInstaller artifacts (Release) #14

Build PyInstaller artifacts (Release)

Build PyInstaller artifacts (Release) #14

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
- name: Windows
os: windows-latest
dist_file_name: betty.exe
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 }}-${{ hashFiles('./setup.py') }}
restore-keys: |
pip-${{ runner.os }}-
- 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 --clobber
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}