Skip to content

Commit

Permalink
Work around slashes not being suppoerted in docker tags
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhand committed Jan 16, 2025
1 parent 28b503d commit 2ccaf7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/twilio-lambda-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ jobs:
# Extracting directory and lambda name from the lambda path
build_lambda_dir=$(dirname $lambda_full_path)
build_lambda_name=$(basename $lambda_full_path)
ref_name=${{ github.ref_name }}
echo "build_lambda_name=$build_lambda_name" >> $GITHUB_ENV
echo "build_lambda_dir=$build_lambda_dir" >> $GITHUB_ENV
echo "ref_name_for_docker="${ref_name//$'\/'/_-}" >> $GITHUB_ENV
shell: bash
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
Expand All @@ -108,7 +110,7 @@ jobs:
lambda_dir=${{ env.build_lambda_dir }}
push: true
# 'latest' is never used, but it keeps terraform happy
tags: ${{ env.ECR_URL }}:${{ github.ref_type }}.${{ github.ref_name }},${{ env.ECR_URL }}:${{ github.sha }},${{ env.ECR_URL }}:latest
tags: ${{ env.ECR_URL }}:${{ github.ref_type }}.${{ env.ref_name_for_docker }},${{ env.ECR_URL }}:${{ github.sha }},${{ env.ECR_URL }}:latest

- name: Generate output
id: generate-output
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/twilio-lambda-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ jobs:
# that is pushed in the primary region available in all other regions.
- name: Update Lambda and Publish
run: |
DOCKER_IMAGE=$(echo "${{ env.ECR_URL }}:${{ github.ref_type }}.${{ github.ref_name }}" | sed -r 's/${{ env.PRIMARY_AWS_REGION }}/${{ inputs.region }}/g')
REF_NAME="${{ github.ref }}"
REF_NAME_FOR_DOCKER_TAG="${ref_name//$'\/'/_-}"
DOCKER_IMAGE=$(echo "${{ env.ECR_URL }}:${{ github.ref_type }}.$REF_NAME_FOR_DOCKER_TAG" | sed -r 's/${{ env.PRIMARY_AWS_REGION }}/${{ inputs.region }}/g')
LAMBDA_NAME=$(basename "./${{ matrix.lambda_path == 'account-scoped' && 'acctscpe' || matrix.lambda_path }}")
SHORT_LAMBDA_NAME=${{ matrix.lambda_path== 'account-scoped' }}
Expand Down

0 comments on commit 2ccaf7d

Please sign in to comment.