【发布时间】:2022-01-17 09:08:00
【问题描述】:
我正在尝试使用发布标签基于日期的 GitHub Actions 创建 project 的自动发布。我不想使用标准语义版本控制,因为这个项目是另一个使用基于日期的版本控制的项目的分支。我发现了有关在工作流程中获取日期的帖子,并且到目前为止:
name: Publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
publish:
name: Publish release of font files
runs-on: ubuntu-latest
steps:
- name: Create foo file
run: |
mkdir cascadios
> cascadios/foo.txt
- name: Get tag name from date
id: tag_name
run: echo "::set-output name=date::$(date +'%y%m.%d')"
- name: Zip font files
run: |
cd cascadios
zip ../cascadios-${{ steps.tag_name.outputs.date }}.zip *
cd ..
- name: Create tag
uses: mathieudutour/github-tag-action@v6.0
id: tag_version
with:
github_token: ${{ github.token }}
custom_tag: ${{ steps.tag_name.outputs.date }}
注意:我让它创建一个空白文件来释放以节省 15 分钟的构建时间。
这很好用,直到我在一天内发布了两个版本(例如今天我正在大量测试此工作流程)。我怎样才能得到它,这样我就可以在标签中添加一个动态补丁号,这样就不会引起冲突?一个示例可能类似于 v2112.13.0。
【问题讨论】:
标签: tags github-actions versioning