deploy

yuush10 的头像作者 yuush10

构建 TypeScript、运行测试并将代码推送到Google Apps Script。用于部署、推送更改或当用户说部署、推送或发布时使用。

📖 中文导读:构建 TypeScript、运行测试并将代码推送到Google Apps Script。用于部署、推送更改或当用户说部署、推送或发布时使用。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: deploy description: Build TypeScript, run tests, and push to Google Apps Script. Use for deployment, pushing changes, or when the user says deploy, push, or release. allowed-tools: Bash, Read, Grep

Deploy to Google Apps Script

Performs the complete build-test-push workflow for deploying to Google Apps Script.

Pre-Deployment Checklist

Before deploying:

  • Ensure you are on the correct branch
  • All changes are committed
  • Quality checks pass

Workflow

Step 1: Run Quality Checks

npm test && npx tsc --noEmit

STOP if any tests fail. Do not proceed with deployment.

Step 2: Build Bundle

npm run build

Verify:

  • dist/bundle.js is generated
  • No build errors
  • File size is reasonable (< 1MB)

Step 3: Push to GAS

clasp push

Watch for:

  • Authentication errors (run clasp login if needed)
  • File upload confirmation
  • No manifest errors

Step 4: Verify Deployment

clasp open

In Apps Script editor:

  • Verify bundle.js is updated
  • Check manifest (appsscript.json) is correct

Quick Deploy Command

npm run build && npm test && clasp push

Full Deploy with Version

npm run deploy

Results Summary

Report:

  • Tests: PASS/FAIL
  • Build: PASS/FAIL
  • Push: SUCCESS/FAILED

Troubleshooting

Error Solution
Auth error Run clasp login to refresh credentials
Build error Fix TypeScript errors in src/
Test failure Fix failing tests before push
Push timeout Check network, retry with clasp push

Rollback Procedure

If deployment causes issues:

  1. Revert to previous commit locally
  2. Rebuild: npm run build
  3. Re-push: clasp push