rasterio for crop #25
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 | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- bids23 | |
paths: | |
# Only rebuild website when apps have changed | |
- 'water-bodies/**' | |
- .github/** | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- run: pip install cwltool | |
- run: cwltool --validate water-bodies/app-package.cwl | |
version: | |
needs: validate | |
runs-on: ubuntu-latest | |
outputs: | |
app-version: ${{ steps.set-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O ./yq | |
env: | |
VERSION: v4.2.0 | |
BINARY: yq_linux_amd64 | |
- run: chmod +x ./yq | |
- run: echo "APP_VERSION=$( ./yq e '."s:softwareVersion"' water-bodies/app-package.cwl | tr -d "\n" )" >> $GITHUB_ENV | |
- run: echo app version is $APP_VERSION | |
- id: set-version | |
run: echo "::set-output name=version::$APP_VERSION" | |
container-crop: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: echo version ${{needs.version.outputs.app-version}} | |
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: build & push crop image | |
run: | | |
IMAGE_ID=ghcr.io/terradue/ogc-eo-application-package-hands-on/crop | |
docker build water-bodies/command-line-tools/crop --file water-bodies/command-line-tools/crop/Dockerfile --tag crop | |
docker tag crop $IMAGE_ID:${{needs.version.outputs.app-version}} | |
docker push $IMAGE_ID:${{needs.version.outputs.app-version}} | |
container-normalized-difference: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: echo version ${{needs.version.outputs.app-version}} | |
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: build & push norm_diff image | |
run: | | |
IMAGE_ID=ghcr.io/terradue/ogc-eo-application-package-hands-on/norm_diff | |
docker build water-bodies/command-line-tools/norm_diff --file water-bodies/command-line-tools/norm_diff/Dockerfile --tag norm_diff | |
docker tag norm_diff $IMAGE_ID:${{needs.version.outputs.app-version}} | |
docker push $IMAGE_ID:${{needs.version.outputs.app-version}} | |
container-otsu: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: echo version ${{needs.version.outputs.app-version}} | |
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: build & push otsu image | |
run: | | |
IMAGE_ID=ghcr.io/terradue/ogc-eo-application-package-hands-on/otsu | |
docker build water-bodies/command-line-tools/otsu --file water-bodies/command-line-tools/otsu/Dockerfile --tag otsu | |
docker tag otsu $IMAGE_ID:${{needs.version.outputs.app-version}} | |
docker push $IMAGE_ID:${{needs.version.outputs.app-version}} | |
container-stac: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: echo version ${{needs.version.outputs.app-version}} | |
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: build & push stac image | |
run: | | |
IMAGE_ID=ghcr.io/terradue/ogc-eo-application-package-hands-on/stac | |
docker build water-bodies/command-line-tools/stac --file water-bodies/command-line-tools/stac/Dockerfile --tag stac | |
docker tag stac $IMAGE_ID:${{needs.version.outputs.app-version}} | |
docker push $IMAGE_ID:${{needs.version.outputs.app-version}} | |
container-stage: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: echo version ${{needs.version.outputs.app-version}} | |
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: build & push stage image | |
run: | | |
IMAGE_ID=ghcr.io/terradue/ogc-eo-application-package-hands-on/stage | |
docker build . --file containers/stage/Dockerfile --tag stage | |
docker tag stage $IMAGE_ID:${{needs.version.outputs.app-version}} | |
docker push $IMAGE_ID:${{needs.version.outputs.app-version}} | |
container-cwl-wrapper: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: echo version ${{needs.version.outputs.app-version}} | |
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: build & push cwl-runner image | |
run: | | |
IMAGE_ID=ghcr.io/terradue/ogc-eo-application-package-hands-on/cwl-wrapper | |
docker build . --file containers/cwl-wrapper/Dockerfile --tag cwl-wrapper | |
docker tag cwl-wrapper $IMAGE_ID:${{needs.version.outputs.app-version}} | |
docker push $IMAGE_ID:${{needs.version.outputs.app-version}} | |
publish-artifacts: | |
needs: | |
- container-crop | |
- container-normalized-difference | |
- container-otsu | |
- container-stac | |
- version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: yq -i eval '(.$graph[] | select (.id == "crop") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/crop:${{needs.version.outputs.app-version}}"' water-bodies/app-package.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "norm_diff") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/norm_diff:${{needs.version.outputs.app-version}}"' water-bodies/app-package.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "otsu") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/otsu:${{needs.version.outputs.app-version}}"' water-bodies/app-package.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "stac") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/stac:${{needs.version.outputs.app-version}}"' water-bodies/app-package.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "crop") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/crop:${{needs.version.outputs.app-version}}"' water-bodies/app-package-cloud-native.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "norm_diff") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/norm_diff:${{needs.version.outputs.app-version}}"' water-bodies/app-package-cloud-native.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "otsu") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/otsu:${{needs.version.outputs.app-version}}"' water-bodies/app-package-cloud-native.cwl | |
- run: yq -i eval '(.$graph[] | select (.id == "stac") ).hints.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/stac:${{needs.version.outputs.app-version}}"' water-bodies/app-package-cloud-native.cwl | |
- run: yq -i eval '.requirements.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/stage:${{needs.version.outputs.app-version}}"' stage/stage-in.yaml | |
- run: yq -i eval '.requirements.DockerRequirement.dockerPull = "ghcr.io/terradue/ogc-eo-application-package-hands-on/stage:${{needs.version.outputs.app-version}}"' stage/stage-out.yaml | |
- run: mkdir downloads | |
- run: cp water-bodies/app-package.cwl downloads/app-water-bodies.${{needs.version.outputs.app-version}}.cwl | |
- run: cp water-bodies/app-package-cloud-native.cwl downloads/app-water-bodies-cloud-native.${{needs.version.outputs.app-version}}.cwl | |
- run: cp stage/stage-in.yaml downloads/stage-in.yaml | |
- run: cp stage/stage-out.yaml downloads/stage-out.yaml | |
- run: ls downloads/app-water-bodies.${{needs.version.outputs.app-version}}.cwl | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: application-package | |
path: downloads | |
- name: release | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: false | |
prerelease: false | |
release_name: ${{needs.version.outputs.app-version}} | |
tag_name: ${{needs.version.outputs.app-version}} | |
#body_path: CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: upload linux artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: downloads/app-water-bodies.${{needs.version.outputs.app-version}}.cwl | |
asset_name: app-water-bodies.${{needs.version.outputs.app-version}}.cwl | |
asset_content_type: text/yaml | |
- name: upload linux artifact cloud native | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: downloads/app-water-bodies-cloud-native.${{needs.version.outputs.app-version}}.cwl | |
asset_name: app-water-bodies-cloud-native.${{needs.version.outputs.app-version}}.cwl | |
asset_content_type: text/yaml | |
- name: upload linux artifact stage-in | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: downloads/stage-in.yaml | |
asset_name: stage-in.yaml | |
asset_content_type: text/yaml | |
- name: upload linux artifact stage-out | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: downloads/stage-out.yaml | |
asset_name: stage-out.yaml | |
asset_content_type: text/yaml |