diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..90fd3870 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: CI-Build +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +env: + JAVA_VERSION: '17' + +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 + + - name: Print finished building + run: echo "The app building finished successfully!" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index b157bef6..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: CI-CD-Pipeline-to-AWS -on: - push: - branches: - - master - -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 }} - -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 - - - 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 - name: Deploy - runs-on: ubuntu-latest - steps: - - name: Download JAR - uses: actions/download-artifact@v2 - with: - name: artifact - - - 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: Print finished deployment - run: echo "Deployment completed successfully!"