Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/build-push-deploy-dev.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
node_modules
out
.env*.local

# IDE
.idea
.DS_Store

# Create Fake Data
create-fake-orders.sh
10 changes: 8 additions & 2 deletions lib/api/axiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ export const defaultMutator = <T>(
url: string,
config?: RequestInit
): Promise<T> => {
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);
};
Loading