Merge pull request #56 from giorgimode/develop #132
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: Java CI with Gradle for master branch | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Inject Slack App id | |
uses: jacobtomlinson/gha-find-replace@v2 | |
with: | |
find: "SLACK_APP_ID" | |
replace: "${{ secrets.SLACK_APP_ID }}" | |
regex: false | |
include: "frontend/index.html" | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Read baseVersion from gradle.properties | |
id: read_artifact_version | |
uses: christian-draeger/[email protected] | |
with: | |
path: './gradle.properties' | |
properties: 'baseVersion' | |
- name: Generate deployment package | |
run: zip -j spotmystatus.zip backend/build/libs/spotmystatus-${{ steps.read_artifact_version.outputs.baseVersion }}.jar backend/Procfile && cd backend && zip -r ../spotmystatus.zip .ebextensions .platform | |
- name: Deploy to AWS Beanstalk | |
uses: einaregilsson/beanstalk-deploy@v13 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: SpotMyStatus | |
environment_name: ${{ secrets.BEANSTALK_ENV_NAME }} | |
version_label: ${{ steps.read_artifact_version.outputs.baseVersion }}-${{ github.run_id }}-${{ github.run_number }} | |
use_existing_version_if_available: false | |
wait_for_environment_recovery: 180 | |
region: eu-central-1 | |
deployment_package: spotmystatus.zip |