Skip to content

adds

adds #27

Workflow file for this run

name: Build
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# branches:
# - main
jobs:
createrelease:
name: Create Release
runs-on: [ubuntu-latest]
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Output Release URL File
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt
build:
name: Build packages
needs: createrelease
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
TARGET: macos
CMD_BUILD: pyinstaller -F -n darts-voice-mac -i resources/darts-voice.icns --noconsole --onefile --collect-all vosk darts-voice.py
OUT_FILE_NAME: darts-voice-mac
ASSET_MIME: application/zip
- os: ubuntu-20.04
TARGET: ubuntu
CMD_BUILD: pyinstaller -F -n darts-voice -i resources/darts-voice.svg --noconsole --onefile --collect-all vosk darts-voice.py
OUT_FILE_NAME: darts-voice
ASSET_MIME: application/octet-stream
- os: windows-latest
TARGET: windows
CMD_BUILD: pyinstaller -F -n darts-voice -i resources/darts-voice.ico --noconsole --onefile --collect-all vosk darts-voice.py
OUT_FILE_NAME: darts-voice.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
- os: ubuntu-20.04
TARGET: linux-arm64
CMD_BUILD: |
sudo apt-get update
sudo apt-get install -y qemu-user-static binfmt-support
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static --platform linux/arm64/v8 -v $(pwd):/workdir -w /workdir arm64v8/ubuntu:20.04 bash -c "DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y portaudio19-dev python3-pip && pip install -r requirements.txt && pyinstaller -F -n darts-voice-arm64 -i resources/darts-voice.svg --noconsole --onefile --collect-all vosk darts-voice.py"
OUT_FILE_NAME: darts-voice-arm64
ASSET_MIME: application/octet-stream
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install system dependencies
shell: bash
run: |
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
# macOS specific commands here
brew install portaudio
echo "Installing dependencies for macOS..."
elif [[ "${{ matrix.os }}" == *"ubuntu"* ]]; then
# Ubuntu (all versions) specific commands
sudo apt-get install -y portaudio19-dev
echo "Installing dependencies for Ubuntu..."
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
# Windows specific commands (if any)
echo "Installing dependencies for Windows..."
else
# Optional: for any other OS or default actions
echo "OS not recognized!"
fi
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
pip install -r requirements_mac.txt
else
pip install -r requirements.txt
fi
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Load Release URL File from release job
uses: actions/download-artifact@v1
with:
name: release_url
- name: Get Release File Name & Upload URL
id: get_release_info
shell: bash
run: |
value=`cat release_url/release_url.txt`
echo ::set-output name=upload_url::$value
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME}}
asset_name: ${{ matrix.OUT_FILE_NAME}}
asset_content_type: ${{ matrix.ASSET_MIME}}