---
title: "Deploying a gradle Micronaut service to AWS Elastic Beanstalk with github Actions"
date: 2020-05-21T00:00:00+00:00
author: "poornerd"
tags: ["java", "aws", "github", "micronaut"]
canonical: https://www.poornerd.com/2020/05/21/deploy-gradle-micronaut-to-aws-elastic-beanstalk-with-github-actions.html
source: Raw Markdown twin of the HTML article; content is the original source.
---
Now that I can develop and test my [Micronaut](https://micronaut.io) 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](https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle)
and combined it with a community action for [Beanstalk Deployment](https://github.com/marketplace/actions/beanstalk-deploy). 
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: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_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

```


