-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (77 loc) · 3.07 KB
/
CD_Backend.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CD_Backend
permissions:
contents: write
on:
push:
branches:
- dev
jobs:
version-and-release:
runs-on: ubuntu-latest
outputs:
backimage_version: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: login to docker registry
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: build and push docker backend to registry
uses: docker/build-push-action@v5
with:
context: .
file: backend.Dockerfile
push: true
tags: mohammadsadeghmontazeri/starback:${{ steps.tag_version.outputs.new_tag }}
- name: build and push docker migrate to registry
uses: docker/build-push-action@v5
with:
context: .
file: migrate.Dockerfile
push: true
tags: mohammadsadeghmontazeri/migratestar:${{ steps.tag_version.outputs.new_tag }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: |
steps.tag_version.outputs.changelog
draft: false
prerelease: false
helm-update:
runs-on: ubuntu-latest
needs: [version-and-release]
steps:
- name: Clone Deployment Repository
uses: GuillaumeFalourd/[email protected]
with:
depth: 1
branch: 'main'
owner: 'Star-Academy'
repository: 'Summer1403-Project-Group01-Deployment'
- name: Update Angular Image Tag in Helm Chart
run: |
cd Summer1403-Project-Group01-Deployment/mychart
sed -i 's|image: mohammadsadeghmontazeri/starback:.*|image: mohammadsadeghmontazeri/starback:${{ needs.version-and-release.outputs.backimage_version }}|' values.yaml
sed -i 's|image: mohammadsadeghmontazeri/migratestar:.*|image: mohammadsadeghmontazeri/migratestar:${{ needs.version-and-release.outputs.backimage_version }}|' values.yaml
git config --global user.email "[email protected]"
git config --global user.name "msm1984"
git commit -am "Update webapp and migration image tag to ${{ needs.version-and-release.outputs.backimage_version }}"
- name: Push to Deployment Repository
run: |
cd Summer1403-Project-Group01-Deployment
git remote set-url origin https://x-access-token:${{ secrets.MYPAT }}@github.com/Star-Academy/Summer1403-Project-Group01-Deployment.git
git push