push to ecr repo #13
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: Run Package | |
on: | |
push: | |
branches: | |
- "master" | |
- "release*" | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
run-package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout latest commit in the PR | |
uses: actions/checkout@v3 | |
- name: Set up Docker QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.20" | |
- 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 }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Run make docker | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
GITHUB_SHA: ${{ github.sha }} | |
run: | | |
export IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7) | |
echo "Image tag: $IMAGE_TAG" | |
make docker | |
docker push ${REGISTRY}/amazon-k8s-cni:${IMAGE_TAG} | |
make docker-init | |
docker push ${REGISTRY}/amazon-k8s-cni-init:${IMAGE_TAG} |