Fix winget publish workflow #283
This file contains hidden or 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
| # Copyright (C) 2024–present Loren Eteval & contributors <loren.eteval@proton.me> | |
| # | |
| # This file is part of Furious. | |
| # | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with this program. If not, see <https://www.gnu.org/licenses/>. | |
| name: Github Deploy | |
| on: [ push, pull_request ] | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build-distribution: | |
| name: Build distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install libegl1 | |
| run: | | |
| sudo apt update && sudo apt install -y libegl1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| check-latest: true | |
| - name: Download Python dependencies & latest asset files | |
| run: | | |
| python -c "import sys; print(sys.version)" | |
| python -m pip install --upgrade pip | |
| python -m pip install setuptools wheel | |
| python -m pip install -r requirements.txt | |
| python -m pip install requests | |
| python Deploy.py --download | |
| - name: Build a binary wheel and a source tarball | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: | | |
| dist/*.tar.gz | |
| dist/*.whl | |
| publish-to-pypi: | |
| name: Publish Python distribution to PyPI | |
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
| needs: | |
| - build-distribution | |
| - deploy-binaries | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: deploy-pypi | |
| url: https://pypi.org/p/Furious-GUI | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| deploy-binaries: | |
| name: Deploy binaries on ${{ matrix.os }} Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-22.04, ubuntu-22.04-arm, windows-2022, macos-13, macos-14 ] | |
| python-version: [ "3.11", "3.13" ] | |
| exclude: | |
| - os: ubuntu-22.04 | |
| python-version: "3.11" | |
| - os: windows-2022 | |
| python-version: "3.11" | |
| - os: macos-13 | |
| python-version: "3.11" | |
| - os: macos-14 | |
| python-version: "3.11" | |
| - os: ubuntu-22.04-arm | |
| python-version: "3.13" | |
| include: | |
| - os: windows-2022 | |
| id: win7 | |
| env: | |
| # Last PySide6 version that supports macOS 10.9 & Python 3.11 | |
| PYSIDE6_LEGACY_VERSION: "6.4.3" | |
| PYSIDE6_TARGET_VERSION: "6.8.3" | |
| # PySide6 has Windows ARM64 build since 6.9.0 | |
| PYSIDE6_LATEST_VERSION: "6.9.1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install macOS dependencies | |
| run: | | |
| brew install create-dmg | |
| if: runner.os == 'macOS' | |
| # Remove problematic brew libs if Intel Mac | |
| # Credits: https://github.com/RimSort/RimSort | |
| - name: Remove problematic brew libs on Intel Mac | |
| run: | | |
| brew remove --force --ignore-dependencies openssl@3 | |
| brew cleanup openssl@3 | |
| if: runner.os == 'macOS' && runner.arch == 'X64' | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y libxcb-cursor0 qt6-base-dev patchelf ccache | |
| echo "QMAKE=$(which qmake6)" >> $GITHUB_ENV | |
| if [ "$RUNNER_ARCH" == "X64" ]; then | |
| linuxdeploy_arch="x86_64" | |
| elif [ "$RUNNER_ARCH" == "ARM64" ]; then | |
| linuxdeploy_arch="aarch64" | |
| else | |
| echo "Unknown runner architecture: $RUNNER_ARCH" | |
| exit 1 | |
| fi | |
| echo "linuxdeploy architecture is $linuxdeploy_arch" | |
| linuxdeploy_name=".linuxdeploy-bin" | |
| mkdir ${linuxdeploy_name} | |
| echo "${PWD}/${linuxdeploy_name}" >> $GITHUB_PATH | |
| wget -P ${linuxdeploy_name} https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-${linuxdeploy_arch}.AppImage | |
| wget -P ${linuxdeploy_name} https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/latest/download/linuxdeploy-plugin-qt-${linuxdeploy_arch}.AppImage | |
| wget -P ${linuxdeploy_name} https://github.com/AppImage/appimagetool/releases/latest/download/appimagetool-${linuxdeploy_arch}.AppImage | |
| chmod +x ${linuxdeploy_name}/* | |
| if: runner.os == 'Linux' | |
| - name: Set up Python for Windows7 | |
| uses: LorenEteval/setup-python-win7@v1 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| check-latest: true | |
| if: matrix.id == 'win7' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| check-latest: true | |
| if: matrix.id != 'win7' | |
| - name: Set up PySide6 for Windows7 | |
| uses: LorenEteval/setup-pyside6-win7@v1 | |
| with: | |
| pyside6-version: ${{ env.PYSIDE6_TARGET_VERSION }} | |
| if: matrix.id == 'win7' | |
| - name: Download Python dependencies & latest asset files | |
| run: | | |
| python -c "import sys; print(sys.version)" | |
| python -m pip install --upgrade pip | |
| python -m pip install setuptools wheel | |
| if [ "$RUNNER_OS" == "Linux" ] && [ "$RUNNER_ARCH" == "ARM64" ]; then | |
| python -m pip install "numpy<2" | |
| python -m pip install PySide6-Essentials==6.5.3 | |
| else | |
| python -m pip install PySide6-Essentials==${PYSIDE6_TARGET_VERSION} | |
| fi | |
| python -m pip install -r requirements.txt | |
| python -m pip install nuitka imageio requests | |
| python Deploy.py --download | |
| - name: Set up go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.24" | |
| check-latest: true | |
| if: matrix.id != 'win7' | |
| - name: Install go dependencies | |
| run: | | |
| if [[ "${{ matrix.id }}" == "win7" ]]; then | |
| go_name="go-for-win7-windows-amd64" | |
| go_file="${go_name}.zip" | |
| curl -L -o ${go_file} https://github.com/XTLS/go-win7/releases/latest/download/${go_file} | |
| 7z x ${go_file} -o${go_name} -y | |
| export GOROOT="$PWD/${go_name}" | |
| export CGO_ENABLED=1 | |
| export PATH="${GOROOT}/bin:$PATH" | |
| fi | |
| go version | |
| python -m pip install "Xray-core >= 1.8.8" | |
| python -m pip install "hysteria2 >= 2.0.4" | |
| python -m pip install "tun2socks > 2.5.2" | |
| - name: Set up go legacy | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.20" | |
| check-latest: true | |
| - name: Install go legacy dependencies | |
| run: | | |
| go version | |
| python -m pip install "hysteria > 1.3.5" | |
| - name: Run deploy script | |
| run: | | |
| if [[ "${{ matrix.id }}" == "win7" ]]; then | |
| export WIN_VER_COMPATIBLE="windows" | |
| fi | |
| python Deploy.py | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binary-distributions-${{ matrix.os }}-Python${{ matrix.python-version }} | |
| path: | | |
| Furious-*.zip | |
| Furious-*.dmg | |
| Furious-*.AppImage | |
| github-release: | |
| name: Upload to GitHub Release | |
| needs: | |
| - deploy-binaries | |
| - publish-to-pypi | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # IMPORTANT: mandatory for making GitHub Releases | |
| id-token: write # IMPORTANT: mandatory for sigstore | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: binary-distributions-* | |
| merge-multiple: true | |
| path: dist/ | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release create | |
| '${{ github.ref_name }}' | |
| --repo '${{ github.repository }}' | |
| --notes "" | |
| --generate-notes | |
| --title 'Furious ${{ github.ref_name }}' | |
| - name: Upload artifact to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| # Upload to GitHub Release using the `gh` CLI. | |
| run: >- | |
| gh release upload | |
| '${{ github.ref_name }}' dist/** | |
| --repo '${{ github.repository }}' | |
| publish-winget: | |
| name: Publish to WinGet | |
| runs-on: windows-latest | |
| steps: | |
| - uses: vedantmgoyal9/winget-releaser@v3 | |
| with: | |
| identifier: Package.Identifier | |
| max-versions-to-keep: 5 | |
| token: ${{ secrets.WINGET_TOKEN }} |