Skip to content

Commit

Permalink
chore: add CI to bump geohub data pipeline version (#2314)
Browse files Browse the repository at this point in the history
  • Loading branch information
JinIgarashi authored Nov 17, 2023
1 parent cc47620 commit 7298102
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/bump-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Bump geohub-data-pipeline version
on:
# This workflow will be triggered when the new release tag is created on geohub-data-pipeline repository.concurrency:
# https://github.com/UNDP-Data/geohub-data-pipeline/blob/main/.github/workflows/acr_docker_image.yml
repository_dispatch:
types: [bump-pipeline-version]
workflow_dispatch:

jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: bump data-pipeline version
run: ./backends/k8s/data-pipeline/bump-version.sh

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: release/bump-geohub-data-pipeline
title: "[RELEASE] bump version of geohub-data-pipeline"
delete-branch: true
commit-message: "[RELEASE] bump version of geohub-data-pipeline"
body: |
## Description
This is going to bump the version of geohub-data-pipeline to apply the new pipeline docker image to kubernetes cluster
---
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: release
reviewers: |
iferencik
Thuhaa
JinIgarashi
20 changes: 20 additions & 0 deletions backends/k8s/data-pipeline/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

yaml_file=./yaml/ingest-environment.yaml
url=https://api.github.com/repos/undp-data/geohub-data-pipeline/releases/latest

# extract the latest tag version
tag_name=$(curl -s $url | jq --raw-output '.tag_name')

echo "Latest release version: $tag_name"

imagename="undpgeohub.azurecr.io/geohub-data-pipeline"
pattern="${imagename}:[^ ]*"
sed -E "s|$pattern|$imagename:$tag_name|g" $yaml_file > "${yaml_file}_new"

cat "${yaml_file}_new"

# replace yaml file with new version
mv "${yaml_file}_new" $yaml_file

echo "tag version was replace to $tag_name"

0 comments on commit 7298102

Please sign in to comment.