-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e1c2dc
commit f7e89a5
Showing
3 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
name: Release pipeline | ||
jobs: | ||
test-backend: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
#checkout your github code using actions/[email protected] | ||
- uses: actions/[email protected] | ||
|
||
#do the same with another action (actions/setup-java@v3) that enable to setup jdk 17 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "temurin" # See 'Supported distributions' for available options | ||
java-version: "21" | ||
#finally build your app with the latest command | ||
- name: Build and test with Maven | ||
working-directory: backend-api | ||
run: mvn clean verify | ||
|
||
- name: Send to sonarcloud for static analysis | ||
working-directory: backend-api | ||
run: mvn -B verify sonar:sonar -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} | ||
|
||
# define job to build and publish docker image | ||
build-and-push-docker-image-release: | ||
needs: test-backend | ||
# run only when code is compiling and tests are passing | ||
runs-on: ubuntu-22.04 | ||
env: | ||
DOCKERHUB_TAG: ${{ github.ref_name }} | ||
# steps to perform in job | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build image and push backend | ||
uses: docker/build-push-action@v3 | ||
with: | ||
# relative path to the place where source code with Dockerfile is located | ||
file: ./Dockerfile.api | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/api:$DOCKERHUB_TAG | ||
|
||
- name: Build image and push database | ||
uses: docker/build-push-action@v3 | ||
with: | ||
# relative path to the place where source code with Dockerfile is located | ||
file: ./Dockerfile.db | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/database:$DOCKERHUB_TAG | ||
|
||
|
||
- name: Build image and push httpd | ||
uses: docker/build-push-action@v3 | ||
with: | ||
# relative path to the place where source code with Dockerfile is located | ||
file: ./Dockerfile.http | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/httpd:$DOCKERHUB_TAG |
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