Skip to content

Commit f379b92

Browse files
author
deltron-fr
committed
made changes to the CI
1 parent 7a5c972 commit f379b92

1 file changed

Lines changed: 14 additions & 50 deletions

File tree

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
name: Publish Docker Image - Frontend
1+
name: Publish Docker Images
22

33
on:
44
push:
55
branches:
66
- integration
77

88
jobs:
9-
ci-frontend:
9+
ci-application:
1010

11-
name: Push frontend Docker image to Docker Hub
11+
name: Push Docker images to Docker Hub
1212
runs-on: ubuntu-latest
1313
permissions:
1414
packages: write
@@ -24,11 +24,16 @@ jobs:
2424
- name: Check out the repo
2525
uses: actions/checkout@v4
2626

27-
- name: create env file
27+
- name: create env file for frontend
2828
run: |
2929
cd application/frontend
3030
echo ${{ secrets.VITE_API_URL }} > .env
3131
32+
- name: create env file for backend
33+
run: |
34+
cd application/backend
35+
echo ${{ secrets.ENV_FILE }} > .env
36+
3237
- name: Generate docker image tag
3338
run: echo "IMAGE_TAG=$GITHUB_SHA" >> $GITHUB_ENV && echo $IMAGE_TAG
3439

@@ -38,59 +43,15 @@ jobs:
3843
username: ${{ secrets.DOCKER_USERNAME }}
3944
password: ${{ secrets.DOCKER_PASSWORD }}
4045

41-
- name: Build and upload Docker image
46+
- name: Build and upload Docker frontend image
4247
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
4348
with:
4449
context: application/frontend
4550
file: application/frontend/Dockerfile
4651
push: true
4752
tags: ${{ env.IMAGE_REGISTRY_FRONTEND }}:${{ env.IMAGE_TAG }}
4853

49-
50-
- name: Edit compose file with new tag and push to repo
51-
run: |
52-
cd application
53-
sed -i 's/monitoring-frontend-repo:.*/monitoring-frontend-repo:${{ env.IMAGE_TAG }}/g' compose.app.yaml
54-
git config user.name "github-actions[bot]"
55-
git config user.email "github-actions[bot]@users.noreply.github.com"
56-
git add .
57-
git diff --cached --quiet || git commit -m "Auto update"
58-
git push origin HEAD:integration
59-
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
63-
ci-backend:
64-
name: Push backend image to Dockerhub
65-
runs-on: ubuntu-latest
66-
needs: ci-frontend
67-
permissions:
68-
packages: write
69-
contents: write
70-
env:
71-
IMAGE_REGISTRY_BACKEND: ${{ vars.IMAGE_REGISTRY_BACKEND }}
72-
IMAGE_REGISTRY_FRONTEND: ${{ vars.IMAGE_REGISTRY_FRONTEND }}
73-
if: github.actor != 'github-actions[bot]'
74-
75-
steps:
76-
- name: Checkout repository
77-
uses: actions/checkout@v4
78-
79-
- name: create env file
80-
run: |
81-
cd application/backend
82-
echo ${{ secrets.ENV_FILE }} > .env
83-
84-
- name: Generate docker image tag
85-
run: echo "IMAGE_TAG=$GITHUB_SHA" >> $GITHUB_ENV && echo $IMAGE_TAG
86-
87-
- name: Log in to Docker Hub
88-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
89-
with:
90-
username: ${{ secrets.DOCKER_USERNAME }}
91-
password: ${{ secrets.DOCKER_PASSWORD }}
92-
93-
- name: Build and upload Docker image
54+
- name: Build and upload Docker backend image
9455
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
9556
with:
9657
context: application/backend
@@ -102,11 +63,14 @@ jobs:
10263
- name: Edit compose file with new tag and push to repo
10364
run: |
10465
cd application
66+
sed -i 's/monitoring-frontend-repo:.*/monitoring-frontend-repo:${{ env.IMAGE_TAG }}/g' compose.app.yaml
10567
sed -i 's/monitoring-backend-repo:.*/monitoring-backend-repo:${{ env.IMAGE_TAG }}/g' compose.app.yaml
10668
git config user.name "github-actions[bot]"
10769
git config user.email "github-actions[bot]@users.noreply.github.com"
10870
git add .
10971
git diff --cached --quiet || git commit -m "Auto update"
11072
git push origin HEAD:integration
73+
11174
env:
11275
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+

0 commit comments

Comments
 (0)