gpt4 book ai didi

javascript - 在自定义的 release.yml 文件中获取针对版本号的 git 更改

转载 作者:行者123 更新时间:2023-12-04 11:32:36 26 4
gpt4 key购买 nike

我的目标是创建一个 GitHub 操作,当 release.yml 文件更改时,它要么更新现有版本,要么在检查该版本是否是新版本后创建一个新版本,检查之前的提交。最终想将此添加到我想添加操作和 release.yml 的其他项目中。
我目前遇到的问题是很难解决如何检测 release.yml 文件中针对版本的更改。
对于添加新版本的非常基本的用例,创建 action.yml 并添加一个简单的方法

version_1_0: # id of input
description: '1.0'
required: true
default: 'The most important changes are downgrading the artifact to java7 (from 8) and switching to gmavenplus plugin to compile groovy.
Besides that, there is a lot of restructuring inside of the pom.xml file

# Misc

* Polishing (f2ec0bb, 9e2ae89 and 8654493)

_Reviewed by_: @user'
稍后在 index.js 文件中
const version = core.getInput('version_1_0');
core.setOutput("ver", version);
给出稍后在 GitHub 操作文件中可以获取和清理的输出,然后转发到发布步骤以用于创建发布
  push:
paths:
- release.yml
branches:
- file_change_trigger
jobs:
hello_world_job:
runs-on: ubuntu-latest
name: release notes
outputs:
output1: ${{ steps.step1.outputs.test }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run:
description=${{ steps.hello.outputs.ver }}
echo $description
description="${description//'%'/'%25'}"
description="${description//$'\n'/'%0A'}"
description="${description//$'\r'/'%0D'}"
echo $description
echo "::set-output name=test::$description"

release_note:
name: Create Release
runs-on: ubuntu-latest
needs: hello_world_job
steps:
- name: Checkout code
uses: actions/checkout@v2
# Use the output from the `hello` step
- name: Get the output time
run: echo "${{needs.hello_world_job.outputs.output1}}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{needs.hello_world_job.outputs.output1}}
draft: false
prerelease: false
不幸的是,当我尝试基于差异的基于文件的触发器时,这种方法被证明是不够的。
样本发布.yml
    v1.0:
body:
'The most important changes are downgrading the artifact to java7 (from 8) and switching to gmavenplus plugin to compile groovy.
Besides that, there is a lot of restructuring inside of the pom.xml file

# Misc

* Polishing (f2ec0bb, 9e2ae89 and 8654493)

_Reviewed by_: @user'
v2.0:
body:
'The most important changes are downgrading the artifact to java7 (from 8) and switching to gmavenplus plugin to compile groovy.


# Misc

* Polishing (f2ec0bb, 9e2ae89 and 8654493)

_Reviewed by_: @user'

最佳答案

与其在 release.yml 文件中跟踪更改,不如使用 Github 发布来跟踪和触发 Github 操作。
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release

on:
release:
types: [published]
在这里,您可以选择正确维护版本和更改日志,如果需要,也可以在操作中访问。

关于javascript - 在自定义的 release.yml 文件中获取针对版本号的 git 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67431624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com