release #3
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: release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
artifact_name: bitsrun | |
release_name: bitsrun-x86_64-linux.tar.gz | |
- os: windows-latest | |
artifact_name: bitsrun.exe | |
release_name: bitsrun-x86_64-windows.exe | |
- os: macos-latest | |
artifact_name: bitsrun | |
release_name: bitsrun-universal-macos.tar.gz | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "pip" # caching pip dependencies | |
- name: Set up build tools | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
python -m pip install pyinstaller | |
- name: Compile single executable for Windows/Linux | |
run: pyinstaller --onefile --noconfirm --clean --name=bitsrun src/bitsrun/cli.py | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' | |
- name: Compile single executable for macOS | |
run: pyinstaller --onefile --noconfirm --clean --name=bitsrun --target-arch=universal2 src/bitsrun/cli.py | |
if: matrix.os == 'macos-latest' | |
- name: Package binaries for Linux/macOS | |
run: | | |
cd dist | |
tar -czvf bitsrun.tar.gz bitsrun | |
cd - | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
- name: Upload binaries to GitHub release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/${{ matrix.artifact_name }} | |
asset_name: ${{ matrix.release_name }} | |
tag: ${{ github.ref }} |