From 310c962adad573ccc9b6a68cf7669f02d84ac50a Mon Sep 17 00:00:00 2001 From: msm1984 Date: Wed, 28 Aug 2024 00:50:11 +0330 Subject: [PATCH] feat: ci can change tag in helm now --- .github/workflows/CD_Backend.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CD_Backend.yml b/.github/workflows/CD_Backend.yml index d7a0660..b6af5a6 100644 --- a/.github/workflows/CD_Backend.yml +++ b/.github/workflows/CD_Backend.yml @@ -11,7 +11,8 @@ on: 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 @@ -58,3 +59,29 @@ jobs: 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/clone-github-repo-action@v2.3 + 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 "sadeghmomo2020@gmail.com" + 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 \ No newline at end of file