From 72b5e1caeae448b49d79176b3a9dcbd608ce3073 Mon Sep 17 00:00:00 2001 From: goproslowyo <68455785+goproslowyo@users.noreply.github.com> Date: Sat, 1 Jun 2024 00:46:17 +0000 Subject: [PATCH 1/2] fix: fix casing on repo name --- .github/workflows/build-and-push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 310a4d1..61d612d 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -22,10 +22,11 @@ jobs: run: | REPO_OWNER="${{ github.repository_owner }}" REPO_NAME="${{ github.repository }}" + REPO_NAME=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]') SHORT_SHA=$(git rev-parse --short HEAD) VERSION="v1.1.6" TAG1="ghcr.io/${REPO_OWNER}/${REPO_NAME}:latest" - TAG2="ghcr.io/infosecstreams/streamstatus:${VERSION}-0-${SHORT_SHA}" + TAG2="ghcr.io/${REPO_OWNER}/${REPO_NAME}:${VERSION}-0-${SHORT_SHA}" echo "IMAGE_TAG1=$TAG1" >> $GITHUB_ENV echo "IMAGE_TAG2=$TAG2" >> $GITHUB_ENV From 09f24495332adf6421e7d408af51c642be5de6f6 Mon Sep 17 00:00:00 2001 From: goproslowyo <68455785+goproslowyo@users.noreply.github.com> Date: Sat, 1 Jun 2024 00:48:19 +0000 Subject: [PATCH 2/2] Update build-and-push.yml --- .github/workflows/build-and-push.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 61d612d..a4e3b7f 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -2,8 +2,8 @@ name: Build and Push Docker Image on: push: - branches: - - main + tags: + - 'v*' # This will trigger the workflow on tags that start with 'v' workflow_dispatch: jobs: @@ -17,16 +17,23 @@ jobs: - name: Log in to GitHub Docker registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + - name: Fetch all tags + run: git fetch --tags + + - name: Get the latest tag + id: get_tag + run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV + - name: Set up tags id: vars run: | REPO_OWNER="${{ github.repository_owner }}" REPO_NAME="${{ github.repository }}" - REPO_NAME=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]') + REPO_NAME_LOWER=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]') SHORT_SHA=$(git rev-parse --short HEAD) - VERSION="v1.1.6" - TAG1="ghcr.io/${REPO_OWNER}/${REPO_NAME}:latest" - TAG2="ghcr.io/${REPO_OWNER}/${REPO_NAME}:${VERSION}-0-${SHORT_SHA}" + VERSION="${{ env.LATEST_TAG }}" + TAG1="ghcr.io/${REPO_OWNER}/${REPO_NAME_LOWER}:latest" + TAG2="ghcr.io/infosecstreams/streamstatus:${VERSION}-0-${SHORT_SHA}" echo "IMAGE_TAG1=$TAG1" >> $GITHUB_ENV echo "IMAGE_TAG2=$TAG2" >> $GITHUB_ENV