Skip to content

Commit

Permalink
Add GitHub Actions workflow for CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
abankhele committed Feb 24, 2024
1 parent b4b848d commit 83bf8fc
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Image CI for GHCR
on:
push

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set up JDK 1.17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Build the package
run: mvn --batch-mode -DskipTests package

- name: Run the unit tests
run: mvn --batch-mode -Dmaven.test.failure.ignore=true test

- name: Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Maven Tests
path: target/surefire-reports/*.xml
reporter: java-junit
fail-on-error: true

- name: Build and push the image
run: |
docker login --username abankhele --password ${{secrets.ACCESS_TOKEN}} ghcr.io
docker build -t ghcr.io/abankhele/primes-service:latest --file Dockerfile .
docker push ghcr.io/abankhele/primes-service:latest

0 comments on commit 83bf8fc

Please sign in to comment.