-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (58 loc) · 2.3 KB
/
CI-Merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI-Merge
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Build the Docker image
id: build_image
run: |
docker build -t ${{ vars.DOCKERHUB_USERNAME }}/negar-backend:latest .
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Push the Docker image
run: |
docker push ${{ vars.DOCKERHUB_USERNAME }}/negar-backend:latest
docker tag ${{ vars.DOCKERHUB_USERNAME }}/negar-backend:latest ${{ vars.DOCKERHUB_USERNAME }}/negar-backend:${{ steps.tag_version.outputs.new_tag }}
docker push ${{ vars.DOCKERHUB_USERNAME }}/negar-backend:${{ steps.tag_version.outputs.new_tag }}
- name: Install yq
run: |
sudo apt-get update
sudo snap install yq
- name: Clone Deployment Repository
uses: GuillaumeFalourd/[email protected]
with:
depth: 1
branch: 'main'
owner: 'Star-Academy'
repository: 'Summer1403-Project-Group04-Deployment'
- name: Update values.yaml for backend
run: |
echo "Updating values.yaml for backend..."
cd Summer1403-Project-Group04-Deployment
yq eval ".backend.tag = \"${{ steps.tag_version.outputs.new_tag }}\"" -i values.yaml
git config --local user.email "[email protected]"
git config --local user.name "muhuchah"
git add values.yaml
git commit -m "Update backend tag to ${{ steps.tag_version.outputs.new_tag }}"
- name: Push changes
run: |
cd Summer1403-Project-Group04-Deployment
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/Star-Academy/Summer1403-Project-Group04-Deployment.git
git push origin main