diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4870985 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create-release.outputs.upload_url }} + steps: + - name: release + if: strategy.job-index == 0 + uses: actions/create-release@v1 + id: create-release + with: + draft: false + prerelease: false + release_name: Release ${{ github.ref }} + tag_name: ${{ github.ref }} + body: Builds of ktool for Mac, Linux, and Windows + env: + GITHUB_TOKEN: ${{ github.token }} + upload-release-assets: + needs: create-release + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pyserial pyinstaller + + - name: Create the executable + run: pyinstaller --onefile ktool.py + + - name: Upload the Mac executable + if: matrix.os == 'macos-latest' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: dist/ktool + asset_name: ktool-mac + asset_content_type: application/octet-stream + + - name: Upload the Linux executable + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: dist/ktool + asset_name: ktool-linux + asset_content_type: application/octet-stream + + - name: Upload the Windows executable + if: matrix.os == 'windows-latest' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: dist/ktool.exe + asset_name: ktool-win.exe + asset_content_type: application/octet-stream