Skip to content

👷 chore: Update deployment to a758cac70aba73b042d… #35

👷 chore: Update deployment to a758cac70aba73b042d…

👷 chore: Update deployment to a758cac70aba73b042d… #35

name: Diareat OCR CI/CD
on:
push:
branches: [ "main" ]
jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker login
uses: docker/[email protected]
with:
username: synoti21
password: ${{ secrets.DOCKERHUB_TOKEN }}
logout: true
- name: Get version
id: image
run: |
VERSION=$(echo ${{ github.sha }} | cut -c1-8)
echo VERSION=$VERSION
echo "::set-output name=version::$VERSION"
- name: Build and push to DockerHub
run: |
docker build -t synoti21/diareat_ocr:${{ steps.image.outputs.version }} .
docker push synoti21/diareat_ocr:${{ steps.image.outputs.version }}
CD:
runs-on: ubuntu-latest
needs: CI
steps:
- name: Get version
id: image
run: |
VERSION=$(echo ${{ github.sha }} | cut -c1-8)
echo VERSION=$VERSION
echo "::set-output name=version::$VERSION"
- name: Setup Kustomize
uses: imranismail/[email protected]
- name: Checkout kustomize repository
uses: actions/checkout@v3
with:
repository: CAUSOLDOUTMEN/Diareat_OCR
ref: main
token: ${{ secrets.ACCESS_TOKEN }}
path: Diareat_OCR
- name: Update Kubernetes resources
run: |
cd Diareat_OCR/k8s/
kustomize edit set image synoti21/${{ secrets.PROJECT_NAME }}=synoti21/${{ secrets.PROJECT_NAME }}:${{ steps.image.outputs.version }}
kustomize build .
- name: Commit and push the updated manifest
run: |
cd Diareat_OCR
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git commit -am ":construction_worker: chore: Update deployment to ${{ github.sha }}"
git push