Merge pull request #4 from MohamedBoukthir/keyclock #17
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: readly backend pipeline | |
on: | |
push: | |
branches: | |
- ci/pipeline | |
- master | |
paths: | |
- readly/** | |
- Docker/backend/** | |
- 'docker-compose.yml' | |
- .github/workflows/*-backend.yml | |
jobs: | |
compile: | |
runs-on: ubuntu-latest | |
name: compile project | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup jdk | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- name: compile project | |
run: | | |
cd readly | |
chmod +x ./mvnw | |
./mvnw clean compile | |
build: | |
runs-on: ubuntu-latest | |
name: build project | |
needs: [ compile ] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup jdk | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- name: build project | |
run: | | |
cd readly | |
chmod +x ./mvnw | |
./mvnw clean package -DskipTests | |
build-image: | |
runs-on: ubuntu-latest | |
name: build docker image | |
needs: [ build ] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup jdk | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- name: build project | |
run: | | |
cd readly | |
chmod +x ./mvnw | |
./mvnw clean package -DskipTests | |
- name: Extract project version | |
id: extract_version | |
run: | | |
cd readly | |
echo "VERSION=$(./mvnw -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT | |
- name: login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: build and push to docker hub | |
uses: docker/build-push-action@v5 | |
with: | |
context: readly | |
file: Docker/backend/Dockerfile | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/readly-api:${{ steps.extract_version.outputs.VERSION }}, ${{ secrets.DOCKERHUB_USERNAME }}/readly-api:latest | |
build-args: | | |
PROFILE=dev | |
APP_VERSION=${{ steps.extract_version.outputs.VERSION }} |