Skip to content

Merge pull request #152 from Guts/packaging/improve-metadata #36

Merge pull request #152 from Guts/packaging/improve-metadata

Merge pull request #152 from Guts/packaging/improve-metadata #36

name: "Build πŸ“¦ and release πŸš€"
# Triggers
on:
push:
branches: [master]
paths:
- ".github/workflows/builder_releaser.yml"
- "builder/**/*"
- "dicogis/**/*.py"
tags:
- "*"
# Globals
env:
PROJECT_FOLDER: "dicogis"
PYTHON_VERSION: "3.10"
PYINSTALLER_LOG_LEVEL: "DEBUG"
USE_PATH_FOR_GDAL_PYTHON: yes
# Jobs definition
jobs:
build-ubuntu:
name: "Ubuntu packager πŸ“¦"
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
env:
GDAL_VERSION: 3.*
steps:
- name: Get source code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: Install GDAL binaries
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable && sudo apt-get update
sudo apt install gdal-bin=${{ env.GDAL_VERSION }}
sudo apt install libgdal-dev=${{ env.GDAL_VERSION }}
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
gdal-config --version
- name: Install complementary tools
run: |
sudo apt install python3-tk
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/base.txt
python -m pip install -U -r requirements/packaging.txt
python -m pip install GDAL=="`gdal-config --version`.*"
- name: Generates Executable
run: python -O ./builder/pyinstaller_build_ubuntu.py
- uses: actions/upload-artifact@v3
with:
name: DicoGIS_ubuntu_executable
path: dist/DicoGIS*/
build-windows:
name: "Windows packager πŸ“¦"
runs-on: windows-latest
env:
GDAL_VERSION: 3.4.3
steps:
- name: Get source code
uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/conda-env-dev.yml') }}
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: dicogis-dev
auto-update-conda: true
channels: conda-forge,defaults
channel-priority: true
environment-file: requirements/conda-env-dev.yml
python-version: ${{ env.PYTHON_VERSION }}
use-only-tar-bz2: true
- name: Install project as a package
run: python -m pip install -U -r requirements.txt
- 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@v3
with:
name: DicoGIS_windows_executable
path: dist/DicoGIS*
release:
name: "Release on tag πŸš€"
runs-on: ubuntu-latest
needs: [build-ubuntu, build-windows]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Ubuntu build
uses: actions/download-artifact@v3
with:
name: DicoGIS_ubuntu_executable
path: builds/ubuntu/
- uses: actions/download-artifact@v3
with:
name: DicoGIS_windows_executable
path: builds/windows/
- name: Create/update release on GitHub
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: "builds/*"
generateReleaseNotes: true
omitNameDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}