This commit is contained in:
@@ -10,36 +10,39 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
# Checkout แบบไม่พึ่ง GitHub
|
||||||
uses: actions/checkout@v4
|
- name: Checkout source (manual)
|
||||||
|
run: |
|
||||||
- name: Set up Docker Buildx
|
set -e
|
||||||
uses: docker/setup-buildx-action@v3
|
git clone https://gitea.panmodel.com/admin/lms-backend.git .
|
||||||
|
git checkout ${{ gitea.sha }}
|
||||||
|
|
||||||
|
# Login Docker Hub แบบตรง
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
run: |
|
||||||
with:
|
set -e
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
echo "${{ secrets.DOCKERHUB_TOKEN }}" \
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
|
# Build & Push image แบบตรง
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
run: |
|
||||||
with:
|
set -e
|
||||||
context: .
|
docker build -t satitprompunjai/lms-backend:${{ gitea.sha }} .
|
||||||
push: true
|
docker push satitprompunjai/lms-backend:${{ gitea.sha }}
|
||||||
tags: |
|
|
||||||
satitprompunjai/lms-backend:${{ gitea.sha }}
|
|
||||||
|
|
||||||
|
# Update GitOps repo
|
||||||
- name: Update image tag in lms-k8s
|
- name: Update image tag in lms-k8s
|
||||||
env:
|
env:
|
||||||
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git clone https://admin:${GIT_TOKEN}@gitea.panmodel.com/admin/lms-k8s.git
|
set -e
|
||||||
cd lms-k8s
|
git clone https://admin:${GIT_TOKEN}@gitea.panmodel.com/admin/lms-k8s.git
|
||||||
|
cd lms-k8s
|
||||||
|
|
||||||
sed -i "s|satitprompunjai/lms-backend:.*|satitprompunjai/lms-backend:${{ gitea.sha }}|g" apps/backend/deployment.yaml
|
sed -i "s|satitprompunjai/lms-backend:.*|satitprompunjai/lms-backend:${{ gitea.sha }}|g" apps/backend/deployment.yaml
|
||||||
|
|
||||||
git config user.name "lms-backend-ci"
|
git config user.name "lms-backend-ci"
|
||||||
git config user.email "ci@panmodel.com"
|
git config user.email "ci@panmodel.com"
|
||||||
git commit -am "chore: update lms-backend image to ${{ gitea.sha }}"
|
git diff --quiet || git commit -am "chore: update lms-backend image to ${{ gitea.sha }}"
|
||||||
git push
|
git push
|
||||||
Reference in New Issue
Block a user