UNPKG

klip-sdk

Version:

JavaScript SDK to interact with klip App2App requests

90 lines (82 loc) 2.93 kB
name: Prepare values for GX github actions author: Jeff Kim description: 'Prepare gx github aciton value' inputs: rc_tag: description: '' required: false default: 'v0.0.1-rc.1' current_branch: description: '' required: false default: 'test' type: description: '' required: false default: 'test' outputs: project: description: 'Get the current project name' value: ${{ steps.set-values.outputs.project }} deploy_env: description: 'Get deployed environment' value: ${{ steps.set-values.outputs.deploy_env }} tag: description: 'Get tag without rc' value: ${{ steps.set-values.outputs.tag }} isperf: description: '' value: ${{ steps.set-values.outputs.isperf }} runs: using: "composite" steps: - name: Set custom env values id: set-values shell: bash run: | echo "** SET project **" echo "project=$(echo ${{ github.repository }} | sed -E 's|(^.*\/)||')" >> $GITHUB_OUTPUT echo "role-session-name=$(echo ${{ github.sha }} | cut -c-8)" >> $GITHUB_OUTPUT REF=${{inputs.current_branch}} echo ${REF} echo " ======================= " echo ${REF} | sed 's/./& /g' echo " ======================= " echo "${REF} | base64" TYPE=${{inputs.type}} DEPLOY_ENV=dev QA_TAG_RC='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' QA_TAG_ALPHA='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' echo "isperf=$( echo "false" )" >> $GITHUB_OUTPUT if [[ "${REF}" == "argocd-master" ]]; then DEPLOY_ENV=staging echo "deploy_env=$( echo "${DEPLOY_ENV}" )" >> $GITHUB_OUTPUT exit 0 fi if [[ "${TYPE}" == "tag" ]]; then if [[ "${REF}" =~ ${QA_TAG_RC} ]]; then DEPLOY_ENV=qa echo "isperf=$( echo "perf" )" >> $GITHUB_OUTPUT echo "tag=$(echo ${REF} | sed -E 's|(\-.*)||' | sed 's/./& /g')" >> $GITHUB_OUTPUT echo "REF : ${REF}" elif [[ "${REF}" =~ ${QA_TAG_ALPHA} ]]; then DEPLOY_ENV=qa echo "isperf::$( echo "perf" )" >> $GITHUB_OUTPUT echo "tag=$(echo ${REF} | sed -E 's|(\-.*)||' | sed 's/./& /g')" >> $GITHUB_OUTPUT echo "REF : ${REF}" else echo "Wrong tag regex." DEPLOY_ENV=wrong fi elif [[ "${TYPE}" != "tag" ]]; then if [[ $(echo ${REF} | sed -E 's|(\-.*)||') == "master" ]]; then DEPLOY_ENV=staging elif [[ $(echo ${{github.ref_name}} | sed -E 's|(\-.*)||') == "dev" ]]; then DEPLOY_ENV=dev fi fi echo "deploy_env=$( echo "${DEPLOY_ENV}" )" >> $GITHUB_OUTPUT if [[ "${{ inputs.rc_tag }}" != "v0.0.1-rc.1" ]]; then echo "** SET tag without rc **" echo "tag::$(echo ${{ inputs.rc_tag }} | sed -E 's|(\-.*)||')" >> $GITHUB_OUTPUT fi