【问题标题】:How to publish a whole directory using Github Actions with the semantic-release Github plugin?如何使用带有语义发布 Github 插件的 Github Actions 发布整个目录?
【发布时间】:2021-12-20 15:59:59
【问题描述】:

我想使用语义发布在 Github 版本上发布整个目录(构建目录),但不幸的是它将每个构建文件作为单个资产发布。

复制:

  • 我正在使用 Vue CLI 生成项目vue create foo
  • 将语义发布安装为开发依赖项npm install --save-dev semantic-release
  • 安装用于语义发布的 Github 插件npm install @semantic-release/github -D
  • 使用内容创建.releaserc.json

.

{
    "plugins":[
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      [
        "@semantic-release/github",
        {
          "assets":[
            {
              "path":"dist",
              "label":"foo-${nextRelease.gitTag}"
            }
          ]
        }
      ]
    ]
  }
  • 在 package.json 中将 version 键设置为 0.0.0-development
  • 使用工作流 ci.yml 创建一个 .github/workflows 目录

.

name: CI

on:
  push:
    branches:
      - main

jobs:
  ci:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 16.x

      - name: Install dependencies
        run: npm install

      - name: Run build
        run: npm run build

      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npx semantic-release --branches main
  • 使用feat: pushed 提交并推送它

该版本似乎很好,但不幸的是它没有将 dist 目录作为单个资产发布。

它只是将 dist 中的每个文件作为单个文件发布

添加步骤

  - name: Log
    run: ls

表示dist目录存在

我该如何解决这个问题?

【问题讨论】:

    标签: github npm github-actions semantic-release


    【解决方案1】:

    这似乎是不可能的。所以我必须在构建应用程序后添加这一步

      - name: ZIP build
        run: zip -r dist.zip dist
    

    并将资产配置设置为

            {
              "path":"dist.zip",
              "label":"foo-${nextRelease.gitTag}.zip"
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-17
      • 1970-01-01
      • 2013-06-26
      • 1970-01-01
      • 2020-04-16
      • 1970-01-01
      • 2020-10-11
      • 2020-07-25
      相关资源
      最近更新 更多