feat(deploy): production deployment setup and fixes

- Debian-based api image (bookworm-slim), docker/debian mirrors, prisma
  binaryTargets for openssl 3.0
- nginx: admin SPA under /admin, TLS via acme.sh (ZeroSSL) + auto-renewal
  cron, http->https redirect
- prisma: add origin_goods.delisted migration, sync missing schema
  (good_image/tag_font_color/good_tags), fix users.createdAt Timestamptz
- api: CORS wildcard reflection, helmet CORP cross-origin, price
  backfill in persistProductDetail, categoryIcon ancestor fallback,
  mediaByColor per-color gallery in public goods detail
- admin: /admin base path (vite + router)
- import-data.mjs: udt_name casting, serial sequence advance fix
This commit is contained in:
yeuimu
2026-08-26 14:23:09 +08:00
parent be0b90e68f
commit 6c61a4e871
982 changed files with 74156 additions and 179393 deletions
@@ -1,180 +1,180 @@
# Release Workflow
## Tools
| Tool | Purpose |
| ----------- | --------------------------------- |
| bumpp | Interactive version bumping |
| changelogen | Changelog generation from commits |
| pkg-pr-new | PR preview packages |
## bumpp (Version Bumping)
```bash
pnpm add -D bumpp
```
```json
{
"scripts": {
"release": "bumpp"
}
}
```
Interactive prompt for patch/minor/major. Options:
```json
{
"scripts": {
"release": "bumpp --commit --tag --push"
}
}
```
For monorepos:
```bash
bumpp -r # Recursive
bumpp packages/*/package.json # Specific packages
```
## changelogen (Changelog)
```bash
pnpm add -D changelogen
```
```json
{
"scripts": {
"changelog": "changelogen --release"
}
}
```
Combined workflow:
```json
{
"scripts": {
"release": "changelogen --release && bumpp"
}
}
```
## Full Release Flow
```json
{
"scripts": {
"release": "pnpm lint && pnpm test && changelogen --release && bumpp --commit --tag --push"
}
}
```
CI publishes to npm on tag push.
## pkg-pr-new (PR Previews)
For publishable packages. Creates install links on PRs.
```yaml
# .github/workflows/pkg-pr-new.yml
name: Publish PR
on: pull_request
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install
- run: pnpm build
- run: pnpm dlx pkg-pr-new publish --compact --pnpm
```
For monorepos:
```bash
pnpm dlx pkg-pr-new publish --compact --pnpm './packages/*'
```
PR comment shows:
```
pnpm add https://pkg.pr.new/your-org/your-package@123
```
## Conventional Commits
For changelogen to work:
```
feat: add dark mode support
fix: resolve memory leak in parser
docs: update README
chore: update dependencies
```
## npm Publishing
### Token-based (legacy)
```yaml
- run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```
### OIDC (Recommended)
No token needed. See ci-workflows.md for full setup.
```yaml
- run: pnpm publish --access public --no-git-checks --provenance
```
## Monorepo Publishing
With pnpm:
```bash
pnpm -r publish --access public
```
With bumpp:
```bash
bumpp -r && pnpm -r publish
```
## Pre-release Versions
```bash
bumpp --preid beta # 1.0.0 -> 1.0.1-beta.0
bumpp --preid alpha # 1.0.0 -> 1.0.1-alpha.0
```
## Package.json Requirements
```json
{
"name": "@scope/package",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/org/repo.git"
},
"publishConfig": {
"access": "public"
}
}
```
`repository` required for npm provenance.
# Release Workflow
## Tools
| Tool | Purpose |
| ----------- | --------------------------------- |
| bumpp | Interactive version bumping |
| changelogen | Changelog generation from commits |
| pkg-pr-new | PR preview packages |
## bumpp (Version Bumping)
```bash
pnpm add -D bumpp
```
```json
{
"scripts": {
"release": "bumpp"
}
}
```
Interactive prompt for patch/minor/major. Options:
```json
{
"scripts": {
"release": "bumpp --commit --tag --push"
}
}
```
For monorepos:
```bash
bumpp -r # Recursive
bumpp packages/*/package.json # Specific packages
```
## changelogen (Changelog)
```bash
pnpm add -D changelogen
```
```json
{
"scripts": {
"changelog": "changelogen --release"
}
}
```
Combined workflow:
```json
{
"scripts": {
"release": "changelogen --release && bumpp"
}
}
```
## Full Release Flow
```json
{
"scripts": {
"release": "pnpm lint && pnpm test && changelogen --release && bumpp --commit --tag --push"
}
}
```
CI publishes to npm on tag push.
## pkg-pr-new (PR Previews)
For publishable packages. Creates install links on PRs.
```yaml
# .github/workflows/pkg-pr-new.yml
name: Publish PR
on: pull_request
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install
- run: pnpm build
- run: pnpm dlx pkg-pr-new publish --compact --pnpm
```
For monorepos:
```bash
pnpm dlx pkg-pr-new publish --compact --pnpm './packages/*'
```
PR comment shows:
```
pnpm add https://pkg.pr.new/your-org/your-package@123
```
## Conventional Commits
For changelogen to work:
```
feat: add dark mode support
fix: resolve memory leak in parser
docs: update README
chore: update dependencies
```
## npm Publishing
### Token-based (legacy)
```yaml
- run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```
### OIDC (Recommended)
No token needed. See ci-workflows.md for full setup.
```yaml
- run: pnpm publish --access public --no-git-checks --provenance
```
## Monorepo Publishing
With pnpm:
```bash
pnpm -r publish --access public
```
With bumpp:
```bash
bumpp -r && pnpm -r publish
```
## Pre-release Versions
```bash
bumpp --preid beta # 1.0.0 -> 1.0.1-beta.0
bumpp --preid alpha # 1.0.0 -> 1.0.1-alpha.0
```
## Package.json Requirements
```json
{
"name": "@scope/package",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/org/repo.git"
},
"publishConfig": {
"access": "public"
}
}
```
`repository` required for npm provenance.