使用GitHub Actions创建标签但未发布版本

问题描述 投票:0回答:1

当前在我的GitHub存储库上,我有以下工作流程,每天发布一个夜间快照,并使用当前日期作为发布名称和标记名称:

name: Nightly Snapshot

on:
  schedule:
  - cron: "59 23 * * *"

jobs:
  build:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - name: Get current date
        id: date
        run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
      - name: Checkout branch "master"
        uses: actions/checkout@v2
        with:
          ref: 'master'
      - name: Release snapshot
        id: release-snapshot
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.date.outputs.date }}
          release_name: ${{ steps.date.outputs.date }}
          draft: false
          prerelease: false

GitHub将以此方式创建的所有快照标记为最新版本。但是,我想避免这种情况,并实现类似于what Swift's snapshots are like的功能:快照只是标签;尽管它们出现在发行版中,但它们的处理方式有所不同。

我应该如何修改我的工作流程文件以实现此目的?谢谢!

github github-api github-actions git-tag github-release
1个回答
0
投票
我发现this GitHub action可以按需标记。使用它,我的工作流程可以这样修改:

name: Nightly Snapshot on: schedule: - cron: "59 23 * * *" jobs: tag: name: Tag runs-on: ubuntu-latest steps: - name: Get current date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - name: Checkout branch "master" uses: actions/checkout@v2 with: ref: 'master' - name: Tag snapshot uses: tvdias/[email protected] with: repo-token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ steps.date.outputs.date }}

© www.soinside.com 2019 - 2024. All rights reserved.