From 452f6f8d62ae21d8ef45804f236af4e0520b6628 Mon Sep 17 00:00:00 2001 From: njuguna-n <141340177+njuguna-n@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:41:01 +0300 Subject: [PATCH] fix(#151): failing build github action --- .github/workflows/build.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d08dea..9a7d43f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,14 +21,15 @@ jobs: - name: Get the latest release tag id: get_latest_release - uses: actions/github-script@v6 - with: - script: | - const latestRelease = await github.repos.getLatestRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - }); - return latestRelease.data.tag_name; + run: | + API_RESPONSE=$(curl -sL https://api.github.com/repos/${{ github.repository }}/releases/latest) + + LATEST_TAG=$(echo "$API_RESPONSE" | jq -r .tag_name) + if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then + LATEST_TAG="latest" + fi + + echo "RELEASE_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT - name: Build and push couch2pg uses: docker/build-push-action@v4 @@ -36,7 +37,9 @@ jobs: context: ./couch2pg file: ./couch2pg/Dockerfile push: true - tags: medicmobile/cht-sync-couch2pg:${{ steps.get_latest_release.outputs.result }} + tags: | + medicmobile/cht-sync-couch2pg:${{ steps.get_latest_release.outputs.RELEASE_TAG }} + medicmobile/cht-sync-couch2pg:latest - name: Build and push dataemon uses: docker/build-push-action@v4 @@ -44,4 +47,6 @@ jobs: context: ./dbt file: ./dbt/Dockerfile push: true - tags: medicmobile/dataemon:${{ steps.get_latest_release.outputs.result }} + tags: | + medicmobile/dataemon:${{ steps.get_latest_release.outputs.RELEASE_TAG }} + medicmobile/dataemon:latest