Created
November 30, 2021 14:14
-
-
Save vranystepan/695ea11e5ad8c8edf0bb548b7e94efc6 to your computer and use it in GitHub Desktop.
GitHub actions with private ECR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Test and Deploy' | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
ecr-login: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
outputs: | |
token: ${{ steps.token.outputs.token }} | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
aws-region: eu-central-1 | |
role-to-assume: arn:aws:iam::123456878910:role/github_deploy_zetor | |
- id: token | |
run: | | |
ECR_TOKEN=$(aws ecr get-login-password) | |
echo "::set-output name=token::${ECR_TOKEN}" | |
test-gateway-integration: | |
services: | |
api-test: | |
image: 123456878910.dkr.ecr.eu-central-1.amazonaws.com/some-image:${{ github.sha }} | |
credentials: | |
username: AWS | |
password: ${{needs.ecr-login.outputs.token}} | |
needs: | |
- ecr-login | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment