Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Library Manager Plarform CD Workflow.


on:
push:
branches: [master]


jobs:

cd:
name: Docker Build & Deployb
runs-on: ubuntu-latest

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

- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Set environment variables
run: |
echo "ACR_HOST=${{ secrets.AZURE_ACR_HOST }}" >> $GITHUB_ENV
echo "TAG=${GITHUB_SHA}" >> $GITHUB_ENV

- name: Login to Azure Container Registry (ACR)
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.AZURE_ACR_HOST }}
username: ${{ secrets.AZURE_ACR_USERNAME }}
password: ${{ secrets.AZURE_ACR_PASSWORD }}

- name: Recreate application.properties
run: |
echo "${{ secrets.APPLICATION_PROPERTIES }}" > src/main/resources/application.properties

- name: Build and Push Docker Image to ACR with Compose
run: |
# Build image with SHA tag
docker compose build --build-arg TAG=${TAG} app

# Tag SHA image as latest for Web App auto-deploy
docker tag $ACR_HOST/library-app:${TAG} $ACR_HOST/library-app:latest

# Push both tags
docker compose push app
docker push $ACR_HOST/library-app:latest
11 changes: 2 additions & 9 deletions .github/workflows/ci-cd.yml → .github/workflows/ci-cd.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Library Manager Plarform CI Workflow
name: Library Manager Plarform CI/CD Workflow.

on:
push:
Expand Down Expand Up @@ -95,13 +95,6 @@ jobs:
# Push both tags
docker compose push app
docker push $ACR_HOST/library-app:latest



#- name: Build and Push Docker Image to ACR with Compose
# run: |
# docker compose build
# docker compose push
# docker push $ACR_HOST/library-app:latest



50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Library Manager Plarform CI Workflow.


on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]


jobs:

cd:
name: Build and Test Java SpringBoot Application and Integrate Updates
runs-on: ubuntu-latest

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

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: temurin


- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Recreate application.properties
run: |
echo "${{ secrets.APPLICATION_PROPERTIES }}" > src/main/resources/application.properties

- name: Build with Maven
run: ./mvnw clean package --batch-mode


- name: Run tests
run: ./mvnw test --batch-mode


- name: Show test results
if: always()
run: cat target/surefire-reports/*.txt || echo "No test reports found"