From d1fa3b1e5b8190d26fcee6128c6725e563cd86c5 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Tue, 25 Jul 2023 12:38:57 +0000 Subject: [PATCH] ci: update release for multiple platforms --- .github/workflows/release.yml | 34 +++++++++++++++++++++++++++------- README.md | 2 ++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0cb5f0c..a679670 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,21 @@ on: jobs: deploy: - runs-on: ubuntu-latest + 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 @@ -23,19 +37,25 @@ jobs: python -m pip install -r requirements.txt python -m pip install pyinstaller - - name: Compile single executable for Linux - run: pyinstaller --onefile --noconfirm --clean --name=bitsrun src/bitsrun/cli.py + - name: Compile single executable for Windows/Linux + run: pyinstaller --onefile --noconfirm --clean --name=${{ matrix.artifact_name }} 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=${{ matrix.artifact_name }} --target-arch=universal2 src/bitsrun/cli.py + if: matrix.os == 'macos-latest' - - name: Package binaries + - name: Package binaries for Linux/macOS run: | cd dist - tar -czvf bitsrun.tar.gz bitsrun + tar -czvf ${{ matrix.release_name }} ${{ matrix.artifact_name }} 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/bitsrun.tar.gz - asset_name: bitsrun.tar.gz + file: dist/${{ matrix.artifact_name }} + asset_name: ${{ matrix.release_name }} tag: ${{ github.ref }} diff --git a/README.md b/README.md index f6c7ea4..78482ba 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ After which, install `bitsrun` with `pipx`. pipx install bitsrun ``` +Alternatively, you can download a self-contained executable from [GitHub Releases](https://github.com/BITNP/bitsrun/releases/latest) if you are working from an environment that does not have internet access. + ## Usage ### CLI