Skip to content

Prepare Deb Release, Docker Release, Release to PPA #23

Prepare Deb Release, Docker Release, Release to PPA

Prepare Deb Release, Docker Release, Release to PPA #23

name: Prepare Deb Release, Docker Release, Release to PPA
on:
workflow_run:
workflows: ["Tests for Library"]
types:
- completed
branches:
- 'main'
- 'master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE: viewshed
COMPILER: c++
jobs:
Create-deb-file-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
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 apt-get -y install gdal-bin libgdal-dev
- uses: robinraju/release-downloader@v1.8
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
- name: Build DEB
run: |
cmake --build build --config Release --target all
cmake --build build --config Release --target pack_viewshed_library_deb
- name: Upload DEB file as artifact
uses: actions/upload-artifact@v3
with:
name: viewshed
path: _packages/viewshed_*.deb
- name: Move deb file
run: |
mv _packages/viewshed_*.deb .
- name: Release
uses: softprops/action-gh-release@v1
with:
files: viewshed_*.deb
tag_name: "v${{steps.version.outputs.VERSION}}"
- name: Deploy Documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./documentation
publish_branch: gh-pages
Release-Docker:
runs-on: ubuntu-latest
needs: Create-deb-file-library
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: viewshed
- name: Copy viewshed to docker folder
run: |
mkdir docker/install
mv viewshed_*.deb docker/install/
- uses: robinraju/release-downloader@v1.8
with:
repository: "JanCaha/cpp-simplerasters"
latest: true
fileName: "*.deb"
tarBall: false
zipBall: false
- name: Copy simplerasters to docker folder
run: |
mv simplerasters_*.deb docker/install/
- 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
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
uses: docker/build-push-action@v4
with:
file: docker/Dockerfile
context: docker/
push: true
tags: cahik/viewshed:latest
- name: Build and push Docker image version with Python
uses: docker/build-push-action@v4
with:
file: docker/viewshed_install_from_ppa.dockerfile
context: docker/
push: true
tags: "cahik/viewshed:v${{steps.version.outputs.VERSION}}-python"
- name: Build and push Docker image latest with Python
uses: docker/build-push-action@v4
with:
file: docker/viewshed_install_from_ppa.dockerfile
context: docker/
push: true
tags: cahik/viewshed:latest-python
Release-to-PPA:
runs-on: ubuntu-latest
needs: Create-deb-file-library
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set env
run: |
echo "VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+" | head -n 1)" >> $GITHUB_ENV
echo "DEBIAN_VERSION=$(grep "viewshed (" debian/changelog | grep -E -o -e "[0-9\.-]+" | head -n 1)" >> $GITHUB_ENV
- name: Print Version
run: |
echo "-----"
echo "Project Version"
echo ${PACKAGE}
echo ${VERSION}
echo ${DEBIAN_VERSION}
echo "-----"
- name: install build tools
run: |
sudo apt-get update
sudo apt-get install debhelper devscripts dput
- name: import gpg key 55C76CE00DD5C647
run: |
echo "${GPG_PRIVATE_KEY}" | base64 --decode | gpg --batch --quiet --import
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 55C76CE00DD5C647 --dry-run --sign README.md
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create tar.gz package
run: |
cd ..
dir
tar -acf "${PACKAGE}"_"${VERSION}".orig.tar.gz cpp-viewshed-library
ls -l
- name: Debuild
run: debuild -S -sa -d
env:
DEBSIGN_PROGRAM: gpg --batch --pinentry-mode loopback
DEBSIGN_KEYID: 55C76CE00DD5C647
- name: Show Files
run: |
cd ..
ls -l
- name: Dput to Repo
run: |
cd ..
dput ppa:jancaha/gis-tools "${PACKAGE}"_"${DEBIAN_VERSION}"_source.changes
- name: Create Issue
uses: dacbd/create-issue-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: JanCaha
repo: viewshed-library-pybind11
title: Release new version
body: |
PPA updated with new version of viewshed library. The viewshed python library needs new relase, when the latest viewshed library is online.