From bfed0337c7eec35d6021173de1c5af7b7a24f1f6 Mon Sep 17 00:00:00 2001 From: LognDH Date: Tue, 10 Mar 2026 23:22:24 +0700 Subject: [PATCH 1/2] Add .gitignore and github CI --- .github/workflows/build-push-deploy-dev.yaml | 62 ++++++++++++++++++++ .gitignore | 4 ++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/build-push-deploy-dev.yaml diff --git a/.github/workflows/build-push-deploy-dev.yaml b/.github/workflows/build-push-deploy-dev.yaml new file mode 100644 index 0000000..31c097b --- /dev/null +++ b/.github/workflows/build-push-deploy-dev.yaml @@ -0,0 +1,62 @@ +name: build push deploy dev + +on: + push: + branches: + - dev + - cicd + workflow_dispatch: +env: + REPO_NAME: ${{ github.event.repository.name }} + BRANCH_NAME: "${{ github.ref_name }}" + FULL_COMMIT_HASH: "${{ github.sha }}" + IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} +jobs: + # This pushes the image to GitHub Packages. + build-push-deploy: + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + steps: + - uses: actions/checkout@v4 + - name: Docker sanity + run: | + echo "Runner: $(uname -a)" + docker --version || true + ls -la + - name: set env + run: | + SHORT_COMMIT_HASH="${FULL_COMMIT_HASH:0:8}" + echo "SHORT_COMMIT_HASH=$SHORT_COMMIT_HASH" >> $GITHUB_ENV + echo "FULL_COMMIT_HASH=$FULL_COMMIT_HASH" >> $GITHUB_ENV + - name: print env + run: | + echo $REPO_NAME + echo $BRANCH_NAME + echo $FULL_COMMIT_HASH + echo $SHORT_COMMIT_HASH + echo $IMAGE_NAME + - name: docker login + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: build + run: | + docker pull $IMAGE_NAME:latest || echo "warn: image is not found" + docker build . --tag $IMAGE_NAME:$BRANCH_NAME --tag $IMAGE_NAME:$BRANCH_NAME-$FULL_COMMIT_HASH --tag $IMAGE_NAME:$BRANCH_NAME-$SHORT_COMMIT_HASH --tag $IMAGE_NAME:latest --label "runnumber=${GITHUB_RUN_ID}" + - name: docker image ls + run: | + docker image ls + - name: push + run: | + docker push $IMAGE_NAME:latest + docker push $IMAGE_NAME:$BRANCH_NAME + docker push $IMAGE_NAME:$BRANCH_NAME-$FULL_COMMIT_HASH + docker push $IMAGE_NAME:$BRANCH_NAME-$SHORT_COMMIT_HASH + - name: git tag + run: | + TAG_NAME="dev-server-all" + git config user.name "GitHub Actions Bot" + git config user.email "actions@github.com" + git tag -f $TAG_NAME + git push -f origin $TAG_NAME \ No newline at end of file diff --git a/.gitignore b/.gitignore index 10f8470..ceff708 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ node_modules out .env*.local + +# IDE +.idea +.DS_Store From e8c9cc1a995c294984103d4d0a9346d128f627d3 Mon Sep 17 00:00:00 2001 From: LognDH Date: Mon, 16 Mar 2026 12:47:46 +0700 Subject: [PATCH 2/2] fix conflict --- .gitignore | 3 +++ lib/api/axiosInstance.ts | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ceff708..09bdfde 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ out # IDE .idea .DS_Store + +# Create Fake Data +create-fake-orders.sh \ No newline at end of file diff --git a/lib/api/axiosInstance.ts b/lib/api/axiosInstance.ts index 786d288..28cfe6b 100644 --- a/lib/api/axiosInstance.ts +++ b/lib/api/axiosInstance.ts @@ -43,10 +43,16 @@ export const defaultMutator = ( url: string, config?: RequestInit ): Promise => { + const isFormData = config?.body instanceof FormData; + return AXIOS_INSTANCE({ url, - method: config?.method as AxiosRequestConfig['method'], - headers: config?.headers as AxiosRequestConfig['headers'], + method: config?.method as AxiosRequestConfig["method"], + headers: { + ...(config?.headers as AxiosRequestConfig["headers"]), + // Remove Content-Type for FormData so Axios sets multipart/form-data with boundary automatically + ...(isFormData && { "Content-Type": undefined }), + }, data: config?.body, }).then((res) => res.data); };