Merge pull request #14 from ThinkfleetAI/feat/flobyte-rekey-task #20
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 and push to ECR | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: {} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| AWS_REGION: us-east-2 | |
| AWS_ROLE_ARN: arn:aws:iam::959429674945:role/gha-thinkfleetai-lago-api | |
| ECR_REGISTRY: 959429674945.dkr.ecr.us-east-2.amazonaws.com | |
| ECR_REPOSITORY: thinkfleet/lago-api | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials via OIDC | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ env.AWS_ROLE_ARN }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Login to Amazon ECR | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Compute tag | |
| id: tags | |
| run: | | |
| UPSTREAM_VERSION=$(cat VERSION 2>/dev/null || date -u +%Y%m%d) | |
| SHORT_SHA=${GITHUB_SHA::7} | |
| IMAGE_TAG="${UPSTREAM_VERSION}-thinkfleet-${SHORT_SHA}" | |
| echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT | |
| echo "Building: ${IMAGE_TAG}" | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ steps.tags.outputs.IMAGE_TAG }} | |
| ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |