game-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGame Deployment
游戏部署
Deploy your browser game for public access.
将你的浏览器游戏部署为公开可访问状态。
GitHub Pages Deployment
GitHub Pages部署
Prerequisites
前置条件
- GitHub CLI installed ()
gh - Git repository initialized and pushed to GitHub
- 已安装GitHub CLI()
gh - Git仓库已初始化并推送到GitHub
Quick Deploy
快速部署
bash
npm run build && npx gh-pages -d distbash
npm run build && npx gh-pages -d distFull Setup
完整设置
- Build the game:
bash
npm run build- Ensure has the correct base path if deploying to a subdirectory:
vite.config.js
js
export default defineConfig({
base: '/<repo-name>/',
// ... rest of config
});- Deploy with GitHub CLI:
bash
gh repo create <game-name> --public --source=. --push
npm install -D gh-pages
npx gh-pages -d dist- Enable GitHub Pages in repo settings (should auto-detect the branch).
gh-pages
Your game is live at:
https://<username>.github.io/<repo-name>/- 构建游戏:
bash
npm run build- 如果部署到子目录,请确保配置了正确的基础路径:
vite.config.js
js
export default defineConfig({
base: '/<repo-name>/',
// ... rest of config
});- 使用GitHub CLI部署:
bash
gh repo create <game-name> --public --source=. --push
npm install -D gh-pages
npx gh-pages -d dist- 在仓库设置中启用GitHub Pages(会自动识别分支)。
gh-pages
你的游戏将在以下地址上线:
https://<username>.github.io/<repo-name>/Automated Deploys
自动化部署
Add to :
package.jsonjson
{
"scripts": {
"deploy": "npm run build && npx gh-pages -d dist"
}
}在中添加以下配置:
package.jsonjson
{
"scripts": {
"deploy": "npm run build && npx gh-pages -d dist"
}
}Play.fun Registration
Play.fun平台注册
After deploying, register your game on Play.fun for monetization. Use the skill for integration details.
/game-creator:playdotfunThe deployed URL becomes your when registering:
gameUrltypescript
await client.games.register({
name: 'Your Game Name',
gameUrl: 'https://<username>.github.io/<repo-name>/',
maxScorePerSession: 500,
maxSessionsPerDay: 20,
maxCumulativePointsPerDay: 5000
});部署完成后,可在Play.fun平台注册你的游戏以实现变现。如需集成细节,请使用技能。
/game-creator:playdotfun部署后的URL将作为你注册时的参数:
gameUrltypescript
await client.games.register({
name: 'Your Game Name',
gameUrl: 'https://<username>.github.io/<repo-name>/',
maxScorePerSession: 500,
maxSessionsPerDay: 20,
maxCumulativePointsPerDay: 5000
});Other Hosting Options
其他托管选项
- Vercel: (auto-detects Vite)
npx vercel --prod - Netlify: Connect repo, set build command to , publish dir to
npm run builddist - Railway: Use the Railway skill for deployment
- itch.io: Upload the folder as an HTML5 game
dist/
- Vercel:执行(会自动识别Vite项目)
npx vercel --prod - Netlify:关联仓库,设置构建命令为,发布目录为
npm run builddist - Railway:使用Railway技能进行部署
- itch.io:上传文件夹作为HTML5游戏
dist/
Pre-Deploy Checklist
部署前检查清单
- succeeds with no errors
npm run build - Test the production build with
npm run preview - Remove any debug statements
console.log - Verify all assets are included in the build
- Check mobile/responsive behavior if applicable
- Set appropriate and meta tags in
<title>index.html
- 执行成功且无报错
npm run build - 使用测试生产构建版本
npm run preview - 移除所有调试语句
console.log - 验证所有资源已包含在构建产物中
- 若适用,检查移动端/响应式表现
- 在中设置合适的
index.html和meta标签<title>