chore: bump org.apache.maven.plugins:maven-assembly-plugin #88
This file contains 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: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
cache: 'maven' | |
- name: Build Maven | |
run: mvn --batch-mode clean package | |
- name: Configure AWS credentials | |
if: github.ref == 'refs/heads/main' | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_PROD_DEMOSTORE }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: ecr-login | |
if: github.ref == 'refs/heads/main' | |
uses: aws-actions/amazon-ecr-login@v2 | |
# $ECR_REGISTRY won't be defined on pull requests | |
# Use a dummy value to allow build in these cases | |
- name: Docker build | |
env: | |
ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }} | |
ECR_REPOSITORY: demostore | |
IMAGE_VERSION: build-${{ github.run_number }} | |
run: | | |
docker build \ | |
--tag ${ECR_REGISTRY:-dummy}/$ECR_REPOSITORY:$IMAGE_VERSION \ | |
--file Dockerfile \ | |
./target | |
- name: Docker push | |
if: github.ref == 'refs/heads/main' | |
env: | |
ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }} | |
ECR_REPOSITORY: demostore | |
IMAGE_VERSION: build-${{ github.run_number }} | |
run: | | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_VERSION |