From 3c7d84df85aba40df6e8953f75818a3e844e7116 Mon Sep 17 00:00:00 2001 From: Yaroslav Pshenichnikov Date: Wed, 17 Jan 2024 17:06:58 +0300 Subject: [PATCH] Fix base64 encoded multiline substitutions --- .github/workflows/sam-pipeline.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sam-pipeline.yml b/.github/workflows/sam-pipeline.yml index 3e21620..8cf8368 100644 --- a/.github/workflows/sam-pipeline.yml +++ b/.github/workflows/sam-pipeline.yml @@ -44,17 +44,14 @@ jobs: - name: Set regions_map and ddb_regions_map variables run: | if [[ "${{ github.ref_name }}" == "develop" ]]; then - echo "REGIONS_MAP=$(echo '${{ secrets.DEVELOP_REGIONS_MAP_BASE64 }}' | base64 -d)" >> $GITHUB_ENV - echo "DDB_REGIONS_MAP=$(echo '${{ secrets.DEVELOP_DDB_REGIONS_MAP_BASE64 }}' | base64 -d)" >> $GITHUB_ENV + echo '${{ secrets.DEVELOP_REGIONS_MAP_BASE64 }}' | base64 -d > regions_map.tmp + echo '${{ secrets.DEVELOP_DDB_REGIONS_MAP_BASE64 }}' | base64 -d > ddb_regions_map.tmp elif [[ "${{ github.ref_name }}" == "main" ]]; then - echo "REGIONS_MAP=$(echo '${{ secrets.MAIN_REGIONS_MAP_BASE64 }}' | base64 -d)" >> $GITHUB_ENV - echo "DDB_REGIONS_MAP=$(echo '${{ secrets.MAIN_DDB_REGIONS_MAP_BASE64 }}' | base64 -d)" >> $GITHUB_ENV + echo '${{ secrets.MAIN_REGIONS_MAP_BASE64 }}' | base64 -d > regions_map.tmp + echo '${{ secrets.MAIN_DDB_REGIONS_MAP_BASE64 }}' | base64 -d > ddb_regions_map.tmp fi - - - name: Update reverse proxy function parameters - run: | - sed -i "s/regionsMap_placeholder/$REGIONS_MAP/g" ./docspace-reverse-proxy/index.mjs - sed -i "s/ddbRegionsMap_placeholder/$DDB_REGIONS_MAP/g" ./docspace-reverse-proxy/index.mjs + sed -i "s|regionsMap_placeholder|$(cat regions_map.tmp)|g" ./docspace-reverse-proxy/index.mjs + sed -i "s|ddbRegionsMap_placeholder|$(cat ddb_regions_map.tmp)|g" ./docspace-reverse-proxy/index.mjs # Build and deploy stack - run: sam build -u --template-file ${GITHUB_REF_NAME}-template.yaml