Skip to content

Commit

Permalink
Create ci-app.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacAndra authored Sep 11, 2024
1 parent fe05adf commit 0d445b8
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI App PipeLine

on: [ push, pull_request ]

jobs:
app:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}


- name: Build Application JAR
working-directory: ./blog-api-server
run: mvn clean package

- name: Docker Compose Build
working-directory: ./blog-api-server
run: docker compose build

- name: Push to Docker Hub Container Registry
run: |
docker tag ${{ secrets.DOCKER_USERNAME }}/blog-api-server:latest ${{ secrets.DOCKER_USERNAME }}/blog-api-server:${{ github.run_id }}
docker push ${{ secrets.DOCKER_USERNAME }}/blog-api-server:${{ github.run_id }}
docker push ${{ secrets.DOCKER_USERNAME }}/blog-api-server:latest

0 comments on commit 0d445b8

Please sign in to comment.