adds #24
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 | |
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 autodarts-voice-mac -i resources/autodarts-voice.icns --noconsole --onefile --collect-all vosk autodarts-voice.py | |
OUT_FILE_NAME: autodarts-voice-mac | |
ASSET_MIME: application/zip | |
- os: ubuntu-20.04 | |
TARGET: ubuntu | |
CMD_BUILD: pyinstaller -F -n autodarts-voice -i resources/autodarts-voice.svg --noconsole --onefile --collect-all vosk autodarts-voice.py | |
OUT_FILE_NAME: autodarts-voice | |
ASSET_MIME: application/octet-stream | |
- os: windows-latest | |
TARGET: windows | |
CMD_BUILD: pyinstaller -F -n autodarts-voice -i resources/autodarts-voice.ico --noconsole --onefile --collect-all vosk autodarts-voice.py | |
OUT_FILE_NAME: autodarts-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 autodarts-voice-arm64 -i resources/autodarts-voice.svg --noconsole --onefile --collect-all vosk autodarts-voice.py" | |
OUT_FILE_NAME: autodarts-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}} |