Ops 5421 reportportal mcp server #6
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 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: Extract metadata | |
if: github.event_name != 'pull_request' | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }} | |
tags: | | |
type=ref,event=branch | |
type=sha,prefix=sha-,format=short | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Extract first tag from metadata | |
if: github.event_name != 'pull_request' | |
id: first_tag | |
run: | | |
echo "TAG=$(echo '${{ steps.meta.outputs.tags }}' | cut -d',' -f1)" >> $GITHUB_OUTPUT | |
- name: Build and push Docker image | |
uses: mend/gh-actions/.github/actions/[email protected] | |
with: | |
repository: ${{ env.ECR_REPOSITORY }} | |
image-tag: ${{ github.event_name == 'pull_request' && 'pr-test' || steps.first_tag.outputs.TAG }} | |
dockerfile-path: . | |
aws-role-to-assume: ${{ vars.AWS_IAM_ROLE_ARN }} | |
aws-region: ${{ env.AWS_REGION }} | |
push: ${{ github.event_name != 'pull_request' }} |