Skip to content

refactor(auth): test cicd #2

refactor(auth): test cicd

refactor(auth): test cicd #2

Workflow file for this run

name: Build and Push Docker Image to ECR
on:
push:
branches:
# - main
# - develop
- feat/cicd
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Build JAR
run: ./gradlew build -x test
- name: Determine ECR Repository
id: ecr_repo
run: |
REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "::set-output name=repo::${REPO_NAME}-prod"
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/feat/cicd" ]]; then
echo "::set-output name=repo::${REPO_NAME}-stag"
else
echo "::error::Unsupported event or branch: ${{ github.event_name }} on ${{ github.ref }}"
exit 1
fi
- name: Docker Build and Push
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ECR_REPOSITORY: ${{ steps.ecr_repo.outputs.repo }}
run: |

Check failure on line 47 in .github/workflows/aws.yaml

View workflow run for this annotation

GitHub Actions / Build and Push Docker Image to ECR

Invalid workflow file

The workflow is not valid. .github/workflows/aws.yaml (Line: 47, Col: 12): Unrecognized named-value: 'ECR_REPOSITORY'. Located at position 1 within expression: ECR_REPOSITORY
docker build -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ ECR_REPOSITORY }}:${{ github.sha }} .
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ ECR_REPOSITORY }}:${{ github.sha }}