From 8a838713fb296ae293a9720f016b394a9caaa168 Mon Sep 17 00:00:00 2001 From: Rupeekshan Maheswaran <63111541+Rupeekshan@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:41:13 +0530 Subject: [PATCH] chore: Set up image publish workflow for feature branches (#414) * chore: Set up workflow for PR image publishing * iterate * use branch name as tag --- .github/workflows/manual-image-publish.yml | 25 ++++++++++++++++++++++ .github/workflows/setup-environment.yml | 10 +++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/manual-image-publish.yml diff --git a/.github/workflows/manual-image-publish.yml b/.github/workflows/manual-image-publish.yml new file mode 100644 index 00000000..86a25c28 --- /dev/null +++ b/.github/workflows/manual-image-publish.yml @@ -0,0 +1,25 @@ +name: Publish images from Feature Branches + +on: + workflow_dispatch: + +jobs: + setup_env: + uses: ./.github/workflows/setup-environment.yml + + build_from_branch: + needs: setup_env + uses: ./.github/workflows/image-build.yml + secrets: inherit + with: + component_version: ${{ needs.setup_env.outputs.component_version }} + + publish_from_branch: + uses: ./.github/workflows/image-publish.yml + needs: build_from_branch + secrets: inherit + with: + gar_push_enabled: true + gar_image_name: us-docker.pkg.dev/vorvan/dev/mlops/temp/h2oai-modelscoring-restscorer + ecr_push_enabled: false + image_tags: "${{ needs.setup_env.outputs.sanitized_branch_name }}" diff --git a/.github/workflows/setup-environment.yml b/.github/workflows/setup-environment.yml index e9ff5bf7..6756b537 100644 --- a/.github/workflows/setup-environment.yml +++ b/.github/workflows/setup-environment.yml @@ -15,6 +15,9 @@ on: component_version: description: "Gradle component version, such as 1.2.3" value: ${{ jobs.setup_env.outputs.component_version }} + sanitized_branch_name: + description: "Branch name where / is replaced by -" + value: ${{ jobs.setup_env.outputs.sanitized_branch_name }} jobs: setup_env: @@ -25,6 +28,7 @@ jobs: release_base_version: ${{ steps.release_base_version.outputs.version }} release_version: ${{ steps.release_version.outputs.version }} component_version: ${{ steps.component_version.outputs.version }} + sanitized_branch_name: ${{ steps.sanitized_branch_name.outputs.name }} steps: - name: Checkout uses: actions/checkout@v4 @@ -62,3 +66,9 @@ jobs: version=0.0.0-pr.${{ steps.commit_hash.outputs.sha }} fi echo "version=$version" >> $GITHUB_OUTPUT + + - name: Save Sanitized Branch Name + id: sanitized_branch_name + run: | + name=$(echo ${{ github.head_ref }} | sed -r 's/\//-/g') + echo "name=$name" >> $GITHUB_OUTPUT