Deploying a gradle Micronaut service to AWS Elastic Beanstalk with github Actions

Posted by Brian Porter on May 21, 2020

Now that I can develop and test my Micronaut Java service in my browser, in the cloud, the next step is automating deployment to AWS Elastic Beanstalk.

I followed the guide on Github for building and testing with Java Gradle and combined it with a community action for Beanstalk Deployment. The result is quite straightforward. (ping me if you have a tip for handling the version better)

name: Java CI with Gradle

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 11
      uses: actions/setup-java@v1
      with:
        java-version: '11.0.4'
    - name: Grant execute permission for gradlew
      run: chmod +x gradlew
    - name: Build with Gradle
      run: ./gradlew build
    - name: Deploy to EB
      uses: einaregilsson/beanstalk-deploy@v10
      with:
        aws_access_key: $
        aws_secret_key: $
        application_name: VinCheck5
        environment_name: Vincheck5-env
        version_label: 12345
        region: eu-west-1
        deployment_package: build/libs/vin-check-0.1-all.jar

If you made it this far, you may as well follow me on LinkedIn: Follow Brian Porter