Skip to content

Prepare Deb Release, Docker Release #33

Prepare Deb Release, Docker Release

Prepare Deb Release, Docker Release #33

name: Prepare Deb Release, Docker Release
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_run:
workflows: ["Tests for Library"]
types:
- completed
branches:
- 'main'
- 'master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE: viewshed
COMPILER: c++
PYTHON_VERSION: "3.10"
jobs:
Create-deb-file-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set env
id: version
run: |
echo "VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+")" >> $GITHUB_ENV
echo "VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+")" >> $GITHUB_OUTPUT
- name: Print Version
run: |
echo "-----"
echo "Project Version"
echo ${PACKAGE}
echo ${VERSION}
echo ${{steps.version.outputs.VERSION}}
echo "-----"
- name: Update and Upgrade
run: |
sudo apt update
sudo apt install ninja-build doxygen libgtest-dev libgmock-dev clang
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
host: 'linux'
- name: Install GDAL
run: |
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt update
sudo apt-get -y install gdal-bin libgdal-dev
- uses: robinraju/[email protected]
with:
repository: "JanCaha/cpp-simplerasters"
latest: true
fileName: "*.deb"
tarBall: false
zipBall: false
- name: Install and remove artifact
run: |
sudo apt install ./simplerasters*.deb
rm simplerasters*
- name: Configure
run: |
mkdir build
cmake \
-S. \
-Bbuild \
-G Ninja \
-DCMAKE_CXX_COMPILER=${COMPILER} \
-DCMAKE_BUILD_TYPE=Release \
-DPACK_DEB:bool=on \
-DBUILD_DOCUMENTATION:bool=on \
-DBUILD_TESTS:bool=on \
-DCELL_EVENT_DATA_FLOAT:bool=on \
-DOUTPUT_RASTER_DATA_FLOAT:bool=on \
-D CMAKE_INSTALL_PREFIX=/usr
- name: Build DEB
run: |
cmake --build build --config Release --target all
cmake --build build --config Release --target pack_viewshed_library_deb
- name: Install from DEB
run: |
sudo apt install ./_packages/viewshed_*.deb
- name: Upload DEB file as artifact
uses: actions/upload-artifact@v4
with:
name: viewshed
path: _packages/viewshed_*.deb
- name: Move deb file
run: |
mv _packages/viewshed_*.deb .
- name: Release
uses: softprops/action-gh-release@v2
with:
files: viewshed_*.deb
tag_name: "v${{steps.version.outputs.VERSION}}"
- name: Deploy Documentation
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./documentation
publish_branch: gh-pages
- uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSION}}
architecture: 'x64'
- name: Install pip packages
run: |
pip install wheel py-build-cmake build
- uses: actions/checkout@v4
with:
repository: 'JanCaha/viewshed-library-pybind11'
path: 'python-package'
submodules: true
- name: Install package
run: |
cd python-package
python -m build .
- uses: actions/upload-artifact@v4
with:
name: python-viewshed
path: python-package/dist/viewshed*.whl
Release-Docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set Env and GA Output
id: version
run: |
echo "VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+")" >> $GITHUB_ENV
echo "VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+")" >> $GITHUB_OUTPUT
- name: Build and push Docker image version with Python
uses: docker/build-push-action@v4
with:
file: docker/Dockerfile
context: docker/
push: true
tags: "cahik/viewshed:v${{steps.version.outputs.VERSION}}"
- name: Build and push Docker image latest with Python
uses: docker/build-push-action@v4
with:
file: docker/Dockerfile
context: docker/
push: true
tags: cahik/viewshed:latest