fix(proxy): HTTP_PROXY env variable was not removed after os_env_prox… #458
This file contains 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
name: "📦 Build & 🚀 Release" | |
# Triggers | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/build_release.yml" | |
- "builder/**/*" | |
- "qgis_deployment_toolbelt/**/*.py" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/build_release.yml" | |
- "builder/" | |
- "requirements/packaging.txt" | |
# Globals | |
env: | |
PROJECT_FOLDER: "qgis_deployment_toolbelt" | |
PYTHON_VERSION: "3.12" | |
PYINSTALLER_LOG_LEVEL: "DEBUG" | |
# Jobs definition | |
jobs: | |
build-python-wheel: | |
name: "🐍 Python Wheel" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/*.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements.txt | |
python -m pip install -U build | |
- name: Install project as a package | |
run: python -m pip install -e . | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--no-isolation | |
--sdist | |
--wheel | |
--outdir dist/ | |
. | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: python_wheel | |
path: dist/* | |
if-no-files-found: error | |
build-macos: | |
name: "🍏 Mac OS" | |
runs-on: macos-12 | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/*.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements.txt | |
python -m pip install -U -r requirements/packaging.txt | |
- name: Install project as a package | |
run: python -m pip install -e . | |
- name: Generates Executable | |
run: python -O ./builder/pyinstaller_build_macos.py | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: macos_executable | |
path: | | |
dist/* | |
build_*.txt | |
if-no-files-found: error | |
build-ubuntu: | |
name: "🐧 Ubuntu LTS" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/*.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements.txt | |
python -m pip install -U -r requirements/packaging.txt | |
- name: Install project as a package | |
run: python -m pip install -e . | |
- name: Generates Executable | |
run: python -O ./builder/pyinstaller_build_ubuntu.py | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu_executable | |
path: | | |
dist/* | |
build_*.txt | |
if-no-files-found: error | |
build-windows: | |
name: "🏠 Windows" | |
runs-on: windows-latest | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/*.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements.txt | |
python -m pip install -U -r requirements/packaging.txt | |
- name: Install project as a package | |
run: python -m pip install -e . | |
- name: Generates MS Version Info | |
run: python .\builder\version_info_templater.py | |
- name: Generates MS Executable | |
run: python -O .\builder\pyinstaller_build_windows.py | |
- name: Save it as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows_executable | |
path: | | |
dist/* | |
build_*.txt | |
if-no-files-found: error | |
release: | |
name: "🚀 GitHub Release" | |
runs-on: ubuntu-latest | |
needs: | |
- build-macos | |
- build-python-wheel | |
- build-ubuntu | |
- build-windows | |
permissions: | |
contents: write | |
discussions: write | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Retrieve artifact from Python build | |
uses: actions/download-artifact@v4 | |
with: | |
name: python_wheel | |
path: builds/wheel/dist/ | |
- name: Retrieve artifact from MacOS build | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos_executable | |
path: builds/macos/ | |
- name: Retrieve artifact from Ubuntu build | |
uses: actions/download-artifact@v4 | |
with: | |
name: ubuntu_executable | |
path: builds/ubuntu/ | |
- name: Retrieve artifact from Windows build | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows_executable | |
path: builds/windows/ | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
discussion_category_name: announcements | |
fail_on_unmatched_files: true | |
files: builds/*/dist/* | |
generate_release_notes: true | |
release-pypi: | |
name: "🐍 Release on PyPI" | |
runs-on: ubuntu-latest | |
needs: | |
- build-python-wheel | |
environment: | |
name: pypi | |
url: https://pypi.org/p/qgis-deployment-toolbelt | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U twine | |
- name: Retrieve artifact from Python build | |
uses: actions/download-artifact@v4 | |
with: | |
name: python_wheel | |
path: builds/wheel/ | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: builds/wheel | |
print-hash: true | |
release-ghcr: | |
name: "🐳 Release as Docker container" | |
runs-on: ubuntu-latest | |
needs: | |
- release | |
- release-pypi | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |