From c8dd33e4dc9d07dfaf88b2b826b5c063cbf0dc05 Mon Sep 17 00:00:00 2001 From: Oleg Kalenik Date: Tue, 18 Jan 2022 16:32:25 +0200 Subject: [PATCH] *re-worked github actions release tagging --- .github/workflows/build-deploy.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-deploy.yaml b/.github/workflows/build-deploy.yaml index f5cce21..0075907 100644 --- a/.github/workflows/build-deploy.yaml +++ b/.github/workflows/build-deploy.yaml @@ -26,6 +26,7 @@ jobs: namespace_prefix: ${{ steps.get-environment.outputs.namespace_prefix }} k8s_ingress_base_host: ${{ steps.get-environment.outputs.k8s_ingress_base_host }} kube_config_data_secret_name: ${{ steps.get-environment.outputs.kube_config_data_secret_name }} + docker_env_tag: ${{ steps.get-environment.outputs.docker_env_tag }} steps: - name: get environment id: get-environment @@ -37,16 +38,21 @@ jobs: echo "::set-output name=namespace_prefix::dao-stats-api-production" echo "::set-output name=k8s_ingress_base_host::api.daostats.io" echo "::set-output name=kube_config_data_secret_name::KUBE_CONFIG_DATA_PRODUCTION" + echo "::set-output name=docker_env_tag::${GITHUB_REF#refs/*/}" elif [[ "${{ github.ref }}" =~ ^refs/heads/staging ]] then echo "::set-output name=environment::staging" echo "::set-output name=namespace_prefix::ds-s" + echo "::set-output name=k8s_ingress_base_host::staging.api.daostats.io" + echo "::set-output name=kube_config_data_secret_name::KUBE_CONFIG_DATA_DEVELOP" + echo "::set-output name=docker_env_tag::staging-$GITHUB_SHA" elif [[ "${{ github.ref }}" =~ ^refs/heads/develop ]] then echo "::set-output name=environment::develop" echo "::set-output name=namespace_prefix::ds-d" echo "::set-output name=k8s_ingress_base_host::development.api.daostats.io" echo "::set-output name=kube_config_data_secret_name::KUBE_CONFIG_DATA_DEVELOP" + echo "::set-output name=docker_env_tag::develop-$GITHUB_SHA" fi if [[ "${{ github.event.inputs.environment }}" != "" ]] then @@ -55,6 +61,7 @@ jobs: echo "::set-output name=namespace_prefix::ds-d" echo "::set-output name=k8s_ingress_base_host::development.api.daostats.io" echo "::set-output name=kube_config_data_secret_name::KUBE_CONFIG_DATA_DEVELOP" + echo "::set-output name=docker_env_tag::develop-$GITHUB_SHA" fi build-image-aggregator: @@ -70,7 +77,7 @@ jobs: - uses: actions/checkout@v2 - name: Set Environment run: | - echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.environment }}-$GITHUB_SHA >> $GITHUB_ENV + echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.docker_env_tag }} >> $GITHUB_ENV cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV cat ".github/env.${{ needs.get-environment.outputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV - name: Docker Build Publish @@ -89,7 +96,7 @@ jobs: - uses: actions/checkout@v2 - name: Set Environment run: | - echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.environment }}-$GITHUB_SHA >> $GITHUB_ENV + echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.docker_env_tag }} >> $GITHUB_ENV cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV cat ".github/env.${{ needs.get-environment.outputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV - name: Docker Build Publish @@ -109,7 +116,7 @@ jobs: - uses: actions/checkout@v2 - name: Set Environment run: | - echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.environment }}-$GITHUB_SHA >> $GITHUB_ENV + echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.docker_env_tag }} >> $GITHUB_ENV cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV cat ".github/env.${{ needs.get-environment.outputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV - name: Helm Deploy @@ -144,7 +151,7 @@ jobs: - uses: actions/checkout@v2 - name: Set Environment run: | - echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.environment }}-$GITHUB_SHA >> $GITHUB_ENV + echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.docker_env_tag }} >> $GITHUB_ENV cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV cat ".github/env.${{ needs.get-environment.outputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV - name: Helm Deploy