diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a9eb6d1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,157 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Release + +on: + push: + tags: + - v[0-9]+.* + pull_request: + tags: + - v[0-9]+.* + +jobs: + build-windows: + runs-on: windows-latest + outputs: + version: ${{ steps.extract_version.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + architecture: x64 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pyinstaller + pip install -r requirements.txt + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - name: Make package + run: | + pyinstaller -w -F LANDrop/main.py -i LANDrop/icons/app.ico -n LANDrop --hidden-import _cffi_backend + - name: Upload artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: LANDrop_windows + path: dist/LANDrop.exe + - name: Get version from tag + id: extract_version + run: | + echo ::set-output name=version::${GITHUB_REF_NAME#v} + shell: bash + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/LANDrop.exe + tag: ${{ github.ref_name }} + asset_name: LANDrop-${{ steps.extract_version.outputs.version }}-windows-x64.exe + body: | + PyLANDrop ${{ github.ref_name }} + + You can get it from [PyPI](https://pypi.org/project/LANDrop/) + + + + build-linux: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.extract_version.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + architecture: x64 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pyinstaller + pip install -r requirements.txt + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Make package + run: | + pyinstaller -F LANDrop/main.py -n LANDrop --hidden-import _cffi_backend + - name: Upload artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: LANDrop_linux + path: dist/LANDrop + - name: Get version from tag + id: extract_version + run: | + echo ::set-output name=version::${GITHUB_REF_NAME#v} + shell: bash + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/LANDrop + tag: ${{ github.ref_name }} + asset_name: LANDrop-${{ steps.extract_version.outputs.version }}-linux-x64 + body: | + PyLANDrop ${{ github.ref_name }} + + You can get it from [PyPI](https://pypi.org/project/LANDrop/) + + build-macos: + runs-on: macos-latest + outputs: + version: ${{ steps.extract_version.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pyinstaller + pip install -r requirements.txt + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - name: Make package + run: | + pyinstaller -w -F LANDrop/main.py -i LANDrop/icons/app.icns -n LANDrop --hidden-import _cffi_backend + - name: Package + working-directory: "./dist" + run: | + zip -r9 --symlinks LANDrop-macos.zip LANDrop.app + - name: Upload artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: LANDrop_macos + path: dist/LANDrop-macos.zip + - name: Get version from tag + id: extract_version + run: | + echo ::set-output name=version::${GITHUB_REF_NAME#v} + shell: bash + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/LANDrop-macos.zip + tag: ${{ github.ref_name }} + asset_name: LANDrop-${{ steps.extract_version.outputs.version }}-macos.zip + body: | + PyLANDrop ${{ github.ref_name }} + + You can get it from [PyPI](https://pypi.org/project/LANDrop/) + +