Skip to content

Commit

Permalink
releases to private ECR
Browse files Browse the repository at this point in the history
  • Loading branch information
nirga committed Feb 15, 2023
1 parent ba89359 commit fa88db9
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
build_and_push_images:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
id-token: write
packages: write

env:
RELEASE_VERSION: "${{ github.event.release.tag_name }}"
DOCKERHUB_REPO: "otel/demo"
GHCR_REPO: "ghcr.io/open-telemetry/demo"
ECR_REPO: "otel-demo"

strategy:
matrix:
Expand Down Expand Up @@ -82,20 +82,17 @@ jobs:
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: ${{ secrets.AWS_DEFAULT_ROLE }}
role-session-name: GithubActions
if: github.event_name != 'pull_request'

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name != 'pull_request'
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -115,7 +112,6 @@ jobs:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{matrix.file_tag.tag_suffix }}
${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{ matrix.file_tag.tag_suffix }}
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPO }}:${{ env.RELEASE_VERSION || 'pr' }}-${{matrix.file_tag.tag_suffix }}
cache-from: type=gha
cache-to: type=gha

0 comments on commit fa88db9

Please sign in to comment.