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
on: [push] | |
jobs: | |
ecr: | |
runs-on: [self-hosted, Linux] | |
name: Docker build and push to ECR | |
env: | |
## Repository must be in the format '<BU>/<SQUAD>/<PROJECT NAME | MY NAME>' | |
ECR_REPOSITORY: 'cross/observability/newrelic-migration-exporter' | |
VERSION: '1.0.0-rc' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# Exemple of build using docker | |
- name: Docker Build | |
run: | | |
docker build --pull -t ${{ secrets.CONTAINER_REGISTRY_HOST }}/$ECR_REPOSITORY:latest . | |
docker tag ${{ secrets.CONTAINER_REGISTRY_HOST }}/$ECR_REPOSITORY:latest ${{ secrets.CONTAINER_REGISTRY_HOST }}/$ECR_REPOSITORY:$VERSION | |
- name: Push to ECR | |
uses: olxbr/aws-ecr-push-action@v1 | |
id: ecr | |
with: | |
# The complete repository name from ECR {BU}/{TEAM}/{PROJECT} (ex. cross/devtools/devtools-scripts). | |
ecr_repository: 'cross/observability/newrelic-migration-exporter' | |
docker_buildkit: 1 | |
# Comma-separated string of ECR image tags (ex. latest, 1.0.0) | |
tags: 'latest,${{env.VERSION}}' | |
keep_images: 10 | |
# Warning! Don't change this env values! | |
# Just copy and paste this whole block as is in your repo | |
env: | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_CROSS_ACCOUNT_ID }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CROSS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CROSS_SECRET_ACCESS_KEY }} | |
AWS_PRINCIPAL_RULES: ${{ secrets.AWS_PRINCIPAL_RULES }} |