0

使用以下脚本发布 Microsoft 团队应用程序:

steps:
  # Setup environment.
  - uses: actions/setup-node@v2
    with:
      node-version: '14'
  - run: npm install

  - name: Checkout the code
    uses: actions/checkout@v2

  - uses: OfficeDev/teamsfx-cli-action@v1
    with:
      commands: validate

  # Publish the Teams App.
  - uses: OfficeDev/teamsfx-cli-action@v1
    with:
      commands: publish

对于验证和发布操作,我收到以下查找包错误:

UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/node_modules/undefined/package.json'
    at Object.openSync (fs.js:497:3)
    at Object.readFileSync (fs.js:393:35)
    at getVersionString (/home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/lib/cli.js:61:28)
    at /home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/lib/cli.js:87:18
    at Generator.next (<anonymous>)
    at /home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/lib/cli.js:30:71
    at new Promise (<anonymous>)
    at __awaiter (/home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/lib/cli.js:26:12)
    at /home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/lib/cli.js:68:8
    at Object.<anonymous> (/home/runner/work/ms-teams-tabs-app/ms-teams-tabs-app/node_modules/teamsfx-cli/lib/cli.js:89:4)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1721) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1721) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

通过控制台在本地运行命令或使用 Visual Code Teams 工具包都可以成功运行而没有问题,我看不出我在这里可能缺少什么。

4

2 回答 2

1

将脚本更新为以下内容以正确安装所需的软件包:

steps:
  # Setup environment.
  - uses: actions/setup-node@v2
    with:
      node-version: '14'
  - uses: pnpm/action-setup@v2.0.1
    with:
        version: 6.12.1
  - name: Checkout
    uses: actions/checkout@v2.3.1
    with:
      persist-credentials: false
  - name: Install and Build 
    run: | # Install npm packages
      pnpm install

  - uses: OfficeDev/teamsfx-cli-action@v1
    with:
      commands: validate

  # Publish the Teams App.
  - uses: OfficeDev/teamsfx-cli-action@v1
    with:
      commands: publish
于 2021-12-02T11:26:36.273 回答
0

@RichardMc 你自己解决了吗?

我可以从第一个版本中看到的一个问题是,您应该在npm install之后运行Checkout,而不是在它之前运行。

其实不用那么麻烦,单独使用action,自己编写工作流文件。Teams 应用程序开发存在 CI/CD 支持,通过脚本涵盖 GitHub、Azure DevOps、Jenkins 和其他平台的平台。您只需复制 GitHub 的预定义 yml 文件并进行自定义以满足您自己的要求。

有关详细信息,请参阅https://aka.ms/teamsfx-cicd-insider-guide 。

于 2021-12-03T06:30:36.033 回答