Adding github actions #1
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-openvisus | |
on: [push] | |
jobs: | |
build-ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.9', '3.10'] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- run: | | |
set -ex | |
GIT_TAG=`git describe --tags --exact-match 2>/dev/null || true` | |
if [[ "${GIT_TAG}" != "" ]] ; then | |
python3 -m pip install --upgrade pip | |
python3 -m pip install hatch | |
python3 -m build . --wheel | |
hatch publish --yes --no-prompt --user ${{ secrets.PYPI_USERNAME }} --client-key ${{ secrets.PYPI_TOKEN }} | |
# get last OpenVisus version | |
python3 -m pip install --upgrade OpenVisusNoGui | |
OPENVISUS_VERSION=$(python3 -c "from importlib.metadata import version;print(version('OpenVisusNoGui'))") | |
# build and publish docker | |
docker build --build-arg="OPENVISUS_VERSION=${OPENVISUS_VERSION}" --build-arg="GIT_TAG=${GIT_TAG}" --tag nsdf/openvisuspy:${GIT_TAG} ./ | |
echo ${{ secrets.DOCKER_TOKEN }} | docker login -u=${{ secrets.DOCKER_USERNAME }} --password-stdin | |
docker push nsdf/openvisuspy:${GIT_TAG} | |
docker push nsdf/openvisuspy:latest | |
fi | |