Skip to content

Merge pull request #3 from mend/OPS-5421-reportportal-mcp-server #12

Merge pull request #3 from mend/OPS-5421-reportportal-mcp-server

Merge pull request #3 from mend/OPS-5421-reportportal-mcp-server #12

name: Build and Push Docker Image
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY }}
AWS_REGION: ${{ vars.AWS_REGION }}
permissions:
id-token: write
contents: read
actions: read
jobs:
build-and-test:
runs-on: [mend-self-hosted, profile=sast-qa]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24.4'
- name: Install Task
uses: arduino/setup-task@v2
- name: Run unit tests
run: task test
- name: Run build (local Go binary)
run: task app:build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_IAM_ROLE_ARN }}
role-session-name: GitHubActionsSession
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}
tags: |
type=ref,event=pr
type=sha,prefix=sha-,format=short
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}