Skip to content

feat: flood detection algorithm #266

feat: flood detection algorithm

feat: flood detection algorithm #266

name: Build, publish and deploy
on:
push:
branches: ['main']
tags:
- 'v*'
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/cogserver
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')}}
tags: |
${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Create release
if: ${{ contains(steps.meta.outputs.tags, ':v') }}
id: create_release
uses: ncipollo/release-action@v1.14.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.ref_name }}
generateReleaseNotes: true
draft: false
skipIfReleaseExists: true
# This job is going to trigger an event named `bump-cogserver-version`
# on undp-data/geohub repo in order to make a PR to bump version of cogserver to AKS
- name: dispatch event to GeoHub repo to create release PR
uses: peter-evans/repository-dispatch@v3
if: ${{ contains(steps.meta.outputs.tags, ':v') }}
with:
repository: undp-data/geohub
# https://www.eliostruyf.com/dispatch-github-action-fine-grained-personal-access-token/
# need scopes of metadata and contents
# created `geohub-data-pipeline-bump` token which will be expired on 12 December 2024
token: ${{ secrets.DISPATCH_PAT }}
event-type: bump-cogserver-version