From a3042548bcce845fbd0b0bd651d117e137b92906 Mon Sep 17 00:00:00 2001 From: David Wilkie Date: Fri, 20 Sep 2024 20:41:23 +0700 Subject: [PATCH] WIP --- .github/workflows/media_proxy.yml | 33 +++++++++++++++++++++++++++++++ .github/workflows/switch.yml | 11 +++++++++++ 2 files changed, 44 insertions(+) diff --git a/.github/workflows/media_proxy.yml b/.github/workflows/media_proxy.yml index 4c4ebb283..74be8978e 100644 --- a/.github/workflows/media_proxy.yml +++ b/.github/workflows/media_proxy.yml @@ -115,6 +115,39 @@ jobs: source_images=$(printf "${{ secrets.ECR_REGISTRY }}/${{ env.REPOSITORY_NAME }}:${{ matrix.friendly_image_tag }}-%s " "${platforms[@]}") docker buildx imagetools create -t ${{ secrets.ECR_REGISTRY }}/${{ env.REPOSITORY_NAME }}:${{ matrix.friendly_image_tag }} -t ${{ secrets.ECR_REGISTRY }}/${{ env.REPOSITORY_NAME }}:${{ matrix.image_tag }} $source_images + publish_images: + name: Publish Images + runs-on: ubuntu-latest + + needs: + - build-packages + + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + role-skip-session-tagging: true + role-duration-seconds: 3600 + aws-region: ap-southeast-1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to ECR + uses: docker/login-action@v3 + with: + registry: ${{ secrets.ECR_REGISTRY }} + - name: Publish Images run: | declare -a platforms=("amd64" "arm64") diff --git a/.github/workflows/switch.yml b/.github/workflows/switch.yml index 23013a905..ceda371cc 100644 --- a/.github/workflows/switch.yml +++ b/.github/workflows/switch.yml @@ -224,23 +224,34 @@ jobs: - name: Publish Images run: | declare -a platforms=("amd64" "arm64") + echo "HERE1" declare -a components=("${{ env.APP_REPOSITORY_NAME }}" "${{ env.WEBSERVER_REPOSITORY_NAME }}" "${{ env.FREESWITCH_REPOSITORY_NAME }}" "${{ env.FREESWITCH_EVENT_LOGGER_REPOSITORY_NAME }}") + echo "HERE2" + for platform in "${platforms[@]}" do + echo "HERE3 $platform" for component in "${components[@]}" do + echo "HERE4 $component" [ "$component" = "${{ env.FREESWITCH_REPOSITORY_NAME }}" ] && [ $platform = "arm64" ] && continue + echo "HERE5 $component" docker image pull ${{ secrets.ECR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }}-$platform + echo "HERE6 $component" docker tag ${{ secrets.ECR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }}-$platform ${{ secrets.ECR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }}-$platform + echo "HERE7 $component" docker push ${{ secrets.ECR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }}-$platform done done for component in "${components[@]}" do + echo "HERE8 $component" if [ "$component" = "${{ env.FREESWITCH_REPOSITORY_NAME }}" ]; then + echo "HERE9 $component" docker buildx imagetools create -t ${{ secrets.GHCR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }} ${{ secrets.GHCR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }}-amd64 else + echo "HERE10 $component" source_images=$(printf "${{ secrets.ECR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }}-%s " "${platforms[@]}") docker buildx imagetools create -t ${{ secrets.ECR_REGISTRY }}/$component:${{ matrix.friendly_image_tag }} $source_images fi