Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

ci: add manually triggered npm distribution publishing

kashorin2f8a0718c75e
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c1b2f930..58b33fa4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -11,9 +11,10 @@ on:
paths-ignore:
- "docs/**"
workflow_dispatch:
+ workflow_call:
concurrency:
- group: ci-${{ github.ref }}
+ group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml
new file mode 100644
index 00000000..3c9bfb50
--- /dev/null
+++ b/.github/workflows/publish-npm.yml
@@ -0,0 +1,98 @@
+name: Publish npm
+run-name: "npm ${{ inputs.version }} — ${{ inputs.publish && 'publish' || 'package only' }}"
+
+on:
+ workflow_dispatch:
+ inputs:
+ version:
+ description: "Version already committed in main's package.json"
+ type: string
+ required: true
+ publish:
+ description: "Publish to npm (unchecked: checks and downloadable package only)"
+ type: boolean
+ default: false
+
+permissions:
+ contents: read
+
+concurrency:
+ group: publish-npm
+ cancel-in-progress: false
+
+jobs:
+ checks:
+ if: github.ref == 'refs/heads/main'
+ uses: ./.github/workflows/ci.yml
+
+ package:
+ needs: checks
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.version.outputs.version }}
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - name: Confirm release version
+ id: version
+ env:
+ EXPECTED_VERSION: ${{ inputs.version }}
+ run: |
+ node --input-type=module <<'JS'
+ import { readFileSync, appendFileSync } from 'node:fs';
+ const { version } = JSON.parse(readFileSync('package.json', 'utf8'));
+ if (!/^\d+\.\d+\.\d+$/.test(version) || version !== process.env.EXPECTED_VERSION) {
+ throw new Error('Enter the stable version already committed in main/package.json.');
+ }
+ appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\n`);
+ JS
+ - uses: pnpm/action-setup@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ - run: pnpm install --frozen-lockfile
+ - name: Build the npm package and README
+ run: npm run pack:distribution
+ - name: Check the packaged CLI
+ env:
+ VERSION: ${{ steps.version.outputs.version }}
+ run: |
+ npm install --prefix "$RUNNER_TEMP/hypit-install" "$PWD/dist/release/hypit-hypit-$VERSION.tgz" --no-audit --no-fund
+ "$RUNNER_TEMP/hypit-install/node_modules/.bin/hypit" --version
+ "$RUNNER_TEMP/hypit-install/node_modules/.bin/hypit" studio --help
+ - uses: actions/upload-artifact@v4
+ with:
+ name: npm-package
+ path: |
+ dist/release/*.tgz
+ dist/release/README.md
+ if-no-files-found: error
+ - name: Record the release inputs
+ env:
+ VERSION: ${{ steps.version.outputs.version }}
+ run: |
+ echo "Prepared @hypit/hypit@$VERSION from $GITHUB_SHA. Download npm-package to inspect the tarball and README." >> "$GITHUB_STEP_SUMMARY"
+
+ publish:
+ if: inputs.publish
+ needs: package
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ steps:
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ registry-url: https://registry.npmjs.org
+ - name: Use npm with trusted publishing support
+ run: npm install --global npm@11
+ - uses: actions/download-artifact@v4
+ with:
+ name: npm-package
+ path: release
+ - name: Publish the prepared tarball
+ env:
+ VERSION: ${{ needs.package.outputs.version }}
+ run: npm publish "release/hypit-hypit-$VERSION.tgz" --access public --tag latest
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6856e048..8b12e797 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -58,6 +58,17 @@ README for the npm page: public image URLs, both GIFs, and a link to the full vi
The repository READMEs remain unchanged. `dist/release/README.md` shows the packaged text.
Publish the resulting tarball with `npm publish dist/release/hypit-hypit-<version>.tgz --access public`.
+For GitHub Actions, commit the next stable npm version in `package.json` to `main`, then open
+**Actions → Publish npm → Run workflow** on `main` and enter that version. Leave **Publish to npm**
+unchecked to run Linux/Windows checks and download the packaged README and tarball; check it to
+publish that run's tarball as `latest` after those checks pass. Each run uses the commit selected
+when it starts. Pushes and tags do not publish, and the workflow does not change versions or create tags.
+
+The npm package's Trusted Publisher settings must allow GitHub Actions from organization `hypit-ai`,
+repository `hypit`, workflow `publish-npm.yml`, with direct `npm publish` enabled and no environment
+name. The publishing job uses OIDC; no npm token secret is needed. An already published version
+cannot be overwritten. npm versions such as `0.1.2` are separate from the logical `@1` interfaces.
+
## Open the pull request
Branch names and commit subjects share the same prefix: `feat/`, `fix/`, `docs/` for branches and
diff --git a/CONTRIBUTING.zh-CN.md b/CONTRIBUTING.zh-CN.md
index 98dc177c..71cee0f1 100644
--- a/CONTRIBUTING.zh-CN.md
+++ b/CONTRIBUTING.zh-CN.md
@@ -50,6 +50,15 @@ pnpm test # 包与服务适配器测试
`dist/release/README.md` 可用于检查打包后的文案。
使用 `npm publish dist/release/hypit-hypit-<version>.tgz --access public` 发布生成的 tarball。
+使用 GitHub Actions 时,先把下一个稳定 npm 版本写入 `package.json` 并提交到 `main`,再进入
+**Actions → Publish npm → Run workflow**,选择 `main` 并填写该版本。不勾选 **Publish to npm**
+时,只运行 Linux/Windows 检查并提供 README 和 tarball 下载;勾选后,在检查通过后将本次打出的
+tarball 发布为 `latest`。每次运行使用启动时选定的提交。push 和 tag 不触发发布,工作流不修改版本或创建标签。
+
+npm 包的 Trusted Publisher 应配置 GitHub Actions:组织 `hypit-ai`、仓库 `hypit`、工作流
+`publish-npm.yml`,允许直接 `npm publish`,环境名称留空。发布 job 使用 OIDC,不需要保存 npm Token。
+已发布的版本不能覆盖;`0.1.2` 等 npm 版本与逻辑接口 `@1` 分开管理。
+
## 提交 Pull Request
分支名与提交信息使用同一套前缀:分支用 `feat/`、`fix/`、`docs/`,提交信息用 `feat:`、`fix:`、`docs:`。