Files
LorenEteval_Furious/.github/workflows/deploy-pypi.yml
T
2026-04-04 23:28:02 +08:00

300 lines
11 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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@v6
- name: Install libegl1
run: |
sudo apt update && sudo apt install -y libegl1
- name: Set up Python
uses: actions/setup-python@v6
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@v7
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@v8
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-2025, macos-15-intel, macos-14 ]
python-version: [ "3.11", "3.13" ]
exclude:
- os: ubuntu-22.04
python-version: "3.11"
- os: windows-2025
python-version: "3.11"
- os: macos-15-intel
python-version: "3.11"
- os: macos-14
python-version: "3.11"
- os: ubuntu-22.04-arm
python-version: "3.13"
include:
- os: windows-2025
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@v6
- 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 zlib1g-dev
sudo apt install -y flatpak flatpak-builder elfutils patchelf
sudo apt install -y rpm
echo "QMAKE=$(which qmake6)" >> $GITHUB_ENV
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak update
flatpak install -y flathub org.kde.Platform//6.8 org.kde.Sdk//6.8
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: Install Windows dependencies
run: |
if [ "$RUNNER_ARCH" == "X64" ]; then
toolset_arch="x64"
elif [ "$RUNNER_ARCH" == "ARM64" ]; then
toolset_arch="arm64"
else
echo "Unknown runner architecture: $RUNNER_ARCH"
exit 1
fi
winget install --id WiXToolset.WiXCLI --version 6.0.2.0 -e --source winget --accept-package-agreements --accept-source-agreements
echo "C:/Program Files/WiX Toolset v6.0/bin" >> $GITHUB_PATH
echo "C:/Program Files/WiX Toolset v6.0/bin/${toolset_arch}" >> $GITHUB_PATH
if: runner.os == 'Windows'
- name: Check Windows dependencies
run: |
wix --version
wix extension add WixToolset.UI.wixext/6.0.2
if: runner.os == 'Windows'
- 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@v6
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@v6
with:
go-version: "1.26"
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@v6
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@v7
with:
name: binary-distributions-${{ matrix.os }}-Python${{ matrix.python-version }}
path: |
Furious-*.zip
Furious-*.msi
Furious-*.dmg
Furious-*.AppImage
Furious-*.deb
Furious-*.flatpak
Furious-*.rpm
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@v8
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
needs:
- github-release
runs-on: windows-latest
steps:
- uses: vedantmgoyal9/winget-releaser@main
with:
identifier: LorenEteval.Furious
release-tag: ${{ github.ref_name }}
installers-regex: '^Furious-.*\.zip$'
max-versions-to-keep: 5
token: ${{ secrets.WINGET_TOKEN }}