首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GitHub发布工作流停止工作,不再运行

GitHub发布工作流停止工作,不再运行
EN

Stack Overflow用户
提问于 2022-01-18 00:51:51
回答 1查看 474关注 0票数 0

我正在为我的组织做一个定制的地形提供者。我按照这里的指示:

在其中提到通过将以下内容复制到我的工作流程目录中来设置GitHub操作的部分:

来自terraform提供者-脚手架存储库(https://github.com/hashicorp/terraform-provider-scaffolding/blob/main/.github/workflows/release.yml)的

  • GitHub操作工作流

不幸的是,这样做似乎导致release工作流不再工作和运行。因此,我希望我能对此有一些全面的了解,因为我试图将它连接到terraform注册中心,并且它不允许我发布它,因为它是一个正常发布配置。

这是回购品:

下面是我在现有的release.yml中使用的用于workflows的代码

代码语言:javascript
复制
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your 
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step 
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
  push:
    tags:
      - 'v*'
jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2.4.0
      -
        name: Unshallow
        run: git fetch --prune --unshallow
      -
        name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.17
      -
        name: Import GPG key
        id: import_gpg
        uses: hashicorp/ghaction-import-gpg@v2.1.0
        env:
          # These secrets will need to be configured for the repository:
          GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
          PASSPHRASE: ${{ secrets.PASSPHRASE }}
      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2.8.0
        with:
          version: latest
          args: release --rm-dist
        env:
          GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
          # GitHub sets this automatically
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

我认为这可能也是我在回购中自动标注的方式,以下是我在tag.yml中使用的方式。

代码语言:javascript
复制
name: 'tag'
on:
  push:
    branches:
      - main
jobs:
  tag:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@v2.4.0
      - name: 'Tag'
        uses: anothrNick/github-tag-action@1.36.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

而且,tag工作流一开始不起作用,但现在起了作用,但我的发布状态只是显示了no status

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-01-19 03:50:45

所以,在经历了很多的懊恼和心痛之后,我发现了它不起作用的原因。我没有具体说明将在哪个分支上触发该行动:

答案:

总体上的变化是将其添加到release.yml中。tag.yml很好。

因此,总的变化如下:

代码语言:javascript
复制
name: 'release'
on:
  push:
    branches:
      - main
    tags:
      - 'v*'
jobs:

最后发布的文件如下所示:

代码语言:javascript
复制
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your 
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step 
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: 'release'
on:
  push:
    branches:
      - main
    tags:
      - 'v*'
jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2.4.0
      -
        name: Unshallow
        run: git fetch --prune --unshallow
      -
        name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.17
      -
        name: Import GPG key
        id: import_gpg
        uses: hashicorp/ghaction-import-gpg@v2.1.0
        env:
          # These secrets will need to be configured for the repository:
          GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
          PASSPHRASE: ${{ secrets.PASSPHRASE }}
      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2.8.0
        with:
          version: latest
          args: release --rm-dist
        env:
          GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
          # GitHub sets this automatically
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70749147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档