Merge pull request #13 from IsaacAndra/dev #24
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: CI App PipeLine | |
on: | |
push: | |
branches: [ "prod" ] | |
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 | |
run: mvn clean package | |
- name: List files | |
run: ls -R | |
- name: Docker Compose Build | |
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 | |