Skip to content

Commit

Permalink
Github
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangWentao-Github authored Sep 22, 2024
1 parent f8af26a commit 7368860
Show file tree
Hide file tree
Showing 81 changed files with 20,514 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example:
# SERVERVAR="foo"
# NEXT_PUBLIC_CLIENTVAR="bar"
33 changes: 33 additions & 0 deletions .github/workflows/auto-fix-for-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Format Code

on:
pull_request:
branches:
- main

jobs:
format-code:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Lint
run: |
bun i
bun run lint:fix
- uses: stefanzweifel/git-auto-commit-action@v5
52 changes: 52 additions & 0 deletions .github/workflows/auto-update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Auto Version Patch

on:
push:
branches:
- main

jobs:
auto-version-patch:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Patch version
id: patch_version
run: |
PKG_VER=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | xargs)
major=$(echo $PKG_VER | cut -d. -f1)
minor=$(echo $PKG_VER | cut -d. -f2)
build=$(echo $PKG_VER | cut -d. -f3)
if [ $build -lt 50 ]; then
build=$((build + 1))
else
build=0
if [ $minor -lt 50 ]; then
minor=$((minor + 1))
else
minor=0
major=$((major + 1))
fi
fi
NEW_VER="$major.$minor.$build"
npm --no-git-tag-version version $NEW_VER
# We don't need a .lock file other than bun.lockb.
rm -rf package-lock.json yarn.lock pnpm-lock.yaml
echo "package_version=$NEW_VER" >> $GITHUB_OUTPUT
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'feat: auto update version ${{ steps.patch_version.outputs.package_version }} ↑'
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal

# next.js
/.next/
/out/
next-env.d.ts

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"singleQuote": true,
"useTabs": false,
"semi": true,
"printWidth": 120,
"jsxSingleQuote": false,
"endOfLine": "auto",
"plugins": ["prettier-plugin-tailwindcss"]
}
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM oven/bun:1 AS base
WORKDIR /app

FROM base AS deps
COPY package.json bun.lockb ./

RUN bun install --frozen-lockfile
RUN bun add -g --arch=x64 --platform=linux sharp

FROM node:18 as build

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY . .

RUN npm run build

FROM base AS runner

USER bun

COPY --from=build /app/package.json ./package.json
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public

ENV NODE_ENV=production

EXPOSE 20481
ENV PORT 20481

CMD ["bun", "run", "start"]
Loading

0 comments on commit 7368860

Please sign in to comment.