Update geoshp for v2 and dynamic projections #87
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: Docker | |
# This will run when: | |
# - a new release is created, to make sure the right tags of the | |
# docker images are pushed (expects tags to be v1.8.4). | |
# - when new code is pushed to master/develop to push the tags | |
# latest and develop | |
# - when a pull request is created and updated to make sure the | |
# Dockerfile is still valid. | |
# To be able to push to dockerhub, this execpts the following | |
# secrets to be set in the project: | |
# - DOCKERHUB_USERNAME : username that can push to the org | |
# - DOCKERHUB_PASSWORD : password asscoaited with the username | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
# Certain actions will only run when this is the master repo. | |
env: | |
MASTER_REPO: clowder-framework/extractors-geo | |
DOCKERHUB_ORG: clowder | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
name: | |
- geotiff-metadata | |
- geoshp-preview | |
- geotiff-preview | |
- pycsw | |
include: | |
- name: geotiff-metadata | |
FOLDER: metadata.geotiff | |
- name: geoshp-preview | |
FOLDER: preview.geoshp | |
- name: geotiff-preview | |
FOLDER: preview.geotiff | |
- name: pycsw | |
FOLDER: pycsw.extractor | |
steps: | |
- uses: actions/checkout@v2 | |
# calculate some variables that are used later | |
- name: Extractor Version | |
run: | | |
version="$(awk '/"version":/ { print $2 }' ${{ matrix.FOLDER }}/extractor_info.json | sed 's/^.*"\([0-9\.]*\)".*$/\1/')" | |
echo "VERSION=${version}" >> $GITHUB_ENV | |
tags="" | |
oldversion="" | |
while [ "${oldversion}" != "${version}" ]; do | |
oldversion="${version}" | |
tags="${version},${tags}" | |
version=${version%.*} | |
done | |
tags="latest,${tags}" | |
echo "TAGS=${tags}" >> $GITHUB_ENV | |
# build the docker image, this will always run to make sure | |
# the Dockerfile still works. | |
- name: Build image | |
uses: elgohr/[email protected] | |
env: | |
VERSION: ${{ env.VERSION }} | |
BUILDNUMBER: ${{ github.run_number }} | |
GITSHA1: ${{ github.sha }} | |
with: | |
registry: docker.pkg.github.com | |
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}/extractors-${{ matrix.NAME }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
context: ${{ matrix.FOLDER }} | |
tags: "${{ env.TAGS }}" | |
buildargs: VERSION,BUILDNUMBER,GITSHA1 | |
no_push: true | |
# this will publish to github container registry | |
- name: Publish to GitHub | |
if: github.event_name == 'push' && github.repository == env.MASTER_REPO | |
uses: elgohr/[email protected] | |
env: | |
VERSION: ${{ env.VERSION }} | |
BUILDNUMBER: ${{ github.run_number }} | |
GITSHA1: ${{ github.sha }} | |
with: | |
registry: ghcr.io | |
name: ${{ github.repository_owner }}/extractors-${{ matrix.NAME }} | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_PASSWORD }} | |
context: ${{ matrix.FOLDER }} | |
tags: "${{ env.TAGS }}" | |
buildargs: VERSION,BUILDNUMBER,GITSHA1 | |
# this will publish to the clowder dockerhub repo | |
- name: Publish to Docker Hub | |
if: github.event_name == 'push' && github.repository == env.MASTER_REPO | |
uses: elgohr/[email protected] | |
env: | |
VERSION: ${{ env.VERSION }} | |
BUILDNUMBER: ${{ github.run_number }} | |
GITSHA1: ${{ github.sha }} | |
with: | |
name: ${{ env.DOCKERHUB_ORG }}/extractors-${{ matrix.NAME }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
context: ${{ matrix.FOLDER }} | |
tags: "${{ env.TAGS }}" | |
buildargs: VERSION,BUILDNUMBER,GITSHA1 | |
# this will update the README of the dockerhub repo | |
- name: check file | |
id: filecheck | |
if: github.event_name != 'push' && github.repository == env.MASTER_REPO | |
run: | | |
if [ "${{ matrix.README }}" != "" -a -e "${{ matrix.README }}" ]; then | |
echo "##[set-output name=exists;]true" | |
else | |
echo "##[set-output name=exists;]false" | |
fi | |
- name: Docker Hub Description | |
if: github.event_name != 'push' && github.repository == env.MASTER_REPO && steps.filecheck.outputs.exists == 'true' | |
uses: peter-evans/dockerhub-description@v2 | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
DOCKERHUB_REPOSITORY: ${{ env.DOCKERHUB_ORG }}/extractors-${{ matrix.NAME }} | |
README_FILEPATH: ${{ matrix.README }} |