-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from Chat-Your-Way/dev_v4
dev_v4: Updated workflow
- Loading branch information
Showing
1 changed file
with
20 additions
and
61 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,30 @@ | ||
name: CI-CD-Pipeline-to-AWS | ||
name: Build CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
branches: | ||
- v3 | ||
|
||
env: | ||
AWS_REGION: eu-central-1 | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
EB_APP_NAME: chat-app | ||
EB_ENV_NAME: Chat-app-env | ||
JAVA_VERSION: '17' | ||
JAR_FILE: chatYourWay-0.0.1-SNAPSHOT.jar | ||
VERSION_LABEL: chat_${{ github.sha }} | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
runs-on: ubuntu-20.04 | ||
|
||
- name: Upload JAR | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: artifact | ||
path: target/${{ env.JAR_FILE }} | ||
|
||
- name: Print finished building | ||
run: echo "The app building finished successfully!" | ||
|
||
deploy: | ||
needs: build | ||
if: github.event_name != 'pull_request' | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download JAR | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
architecture: x64 | ||
cache: 'maven' | ||
|
||
- name: Deploy to EB | ||
uses: einaregilsson/beanstalk-deploy@v13 | ||
with: | ||
aws_access_key: ${{ env.AWS_ACCESS_KEY_ID }} | ||
aws_secret_key: ${{ env.AWS_SECRET_ACCESS_KEY }} | ||
use_existing_version_if_available: false | ||
application_name: ${{ env.EB_APP_NAME }} | ||
environment_name: ${{ env.EB_ENV_NAME }} | ||
version_label: ${{ env.VERSION_LABEL }} | ||
region: ${{ env.AWS_REGION }} | ||
deployment_package: ${{ env.JAR_FILE }} | ||
- name: Build with Maven | ||
run: mvn clean install | ||
|
||
- name: Print finished deployment | ||
run: echo "Deployment completed successfully!" | ||
- name: Finalize Build | ||
run: echo "Build completed successfully!" |