chore: improve ci
Build & Push Docker Image (Backend) / build (push) Successful in 2m5s

This commit is contained in:
Flook
2026-04-28 20:45:14 +07:00
parent 1fe438dea0
commit 1ec6fa68a1
+19 -16
View File
@@ -10,30 +10,33 @@ 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: |
set -e
git clone https://admin:${GIT_TOKEN}@gitea.panmodel.com/admin/lms-k8s.git git clone https://admin:${GIT_TOKEN}@gitea.panmodel.com/admin/lms-k8s.git
cd lms-k8s cd lms-k8s
@@ -41,5 +44,5 @@ jobs:
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