Add release workflow for LocalStack #3
This file contains hidden or 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: build | |
| on: push | |
| jobs: | |
| build: | |
| # this is to prevent the job to run at forked projects | |
| if: github.repository == 'aws/amazon-eks-pod-identity-webhook' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::314666526026:role/github-actions-amazon-eks-pod-identity-webhook | |
| aws-region: us-east-1 | |
| - name: Login to Amazon ECR Public | |
| id: login-ecr-public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Setup Go Version | |
| run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: crazy-max/ghaction-docker-buildx@v3 | |
| with: | |
| buildx-version: latest | |
| qemu-version: latest | |
| - name: Build container and push to Dockerhub registry | |
| run: | | |
| BRANCH=$(echo $GITHUB_REF | cut -d'/' -f3) | |
| SHORT_SHA=$(echo $GITHUB_SHA | cut -c -7) | |
| REPO=public.ecr.aws/eks/amazon-eks-pod-identity-webhook | |
| if [ "$BRANCH" = "master" ]; then | |
| TAG=$SHORT_SHA | |
| else | |
| TAG=$BRANCH | |
| fi | |
| docker buildx build \ | |
| -t $REPO:$TAG \ | |
| --build-arg golang_image=public.ecr.aws/eks-distro-build-tooling/golang:${{ env.GO_VERSION }}-gcc \ | |
| --platform=linux/amd64,linux/arm64 \ | |
| --progress plain \ | |
| --push . | |
| if [ "$BRANCH" = "master" ]; then | |
| docker buildx build \ | |
| -t $REPO:latest \ | |
| --build-arg golang_image=public.ecr.aws/eks-distro-build-tooling/golang:${{ env.GO_VERSION }}-gcc \ | |
| --platform=linux/amd64,linux/arm64 \ | |
| --progress plain \ | |
| --push . | |
| fi | |