action: change release change-log generation logic (#847)

action: change release change-log generation logic
This commit is contained in:
xiaoyifang 2023-06-11 23:00:22 +08:00 committed by GitHub
parent f67f5aa228
commit f7f27f276b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 213 additions and 31 deletions

View file

@ -94,8 +94,8 @@ jobs:
- name: version-file
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "$previousTag">version.txt
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt
- name: compile
run: |
qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=use_xapian
@ -120,7 +120,7 @@ jobs:
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -130,6 +130,8 @@ jobs:
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)"
- name: Set outputs
id: vars
@ -146,13 +148,43 @@ jobs:
uses: mikepenz/release-changelog-builder-action@v3
with:
commitMode: true
fromTag: ${{ steps.changelog.outputs.prev_tag }}
toTag: "${{ steps.changelog.outputs.curr_tag }}"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n## 🔴 #{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature","feat","opt"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix","bug"]
}
,
{
"title": "## 🤖 Github action",
"labels": ["action"]
}
],
"label_extractor": [
{
"pattern": "([^:]*):.*",
"target": "$1",
"on_property": "title",
"flags": "gu"
}
]
}
- name: uploadRelease
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_homebrew_${{steps.vars.outputs.release_date}}.dmg
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -184,4 +216,7 @@ jobs:
CHANGES:
${{ steps.changelog.outputs.changelog }}
----------------
${{steps.build_changelog.outputs.changelog}}

View file

@ -79,8 +79,8 @@ jobs:
- name: version-file
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "$previousTag">version.txt
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt
- name: build goldendict
run: |
@ -108,7 +108,7 @@ jobs:
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -118,6 +118,8 @@ jobs:
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)"
- name: Set outputs
id: vars
@ -134,6 +136,36 @@ jobs:
uses: mikepenz/release-changelog-builder-action@v3
with:
commitMode: true
fromTag: ${{ steps.changelog.outputs.prev_tag }}
toTag: "${{ steps.changelog.outputs.curr_tag }}"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n## 🔴 #{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature","feat","opt"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix","bug"]
}
,
{
"title": "## 🤖 Github action",
"labels": ["action"]
}
],
"label_extractor": [
{
"pattern": "([^:]*):.*",
"target": "$1",
"on_property": "title",
"flags": "gu"
}
]
}
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
@ -141,7 +173,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.vars.outputs.appname }}
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -173,4 +205,7 @@ jobs:
CHANGES:
${{ steps.changelog.outputs.changelog }}
----------------
${{steps.build_changelog.outputs.changelog}}

View file

@ -66,8 +66,8 @@ jobs:
- name: version-file
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "$previousTag">version.txt
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt
- name: build goldendict
run: |
@ -91,7 +91,7 @@ jobs:
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -101,6 +101,8 @@ jobs:
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)"
- name: Set outputs
id: vars
run: |
@ -116,6 +118,36 @@ jobs:
uses: mikepenz/release-changelog-builder-action@v3
with:
commitMode: true
fromTag: ${{ steps.changelog.outputs.prev_tag }}
toTag: "${{ steps.changelog.outputs.curr_tag }}"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n## 🔴 #{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature","feat","opt"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix","bug"]
}
,
{
"title": "## 🤖 Github action",
"labels": ["action"]
}
],
"label_extractor": [
{
"pattern": "([^:]*):.*",
"target": "$1",
"on_property": "title",
"flags": "gu"
}
]
}
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
@ -123,7 +155,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.vars.outputs.appname }}
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -155,4 +187,7 @@ jobs:
CHANGES:
${{ steps.changelog.outputs.changelog }}
----------------
${{steps.build_changelog.outputs.changelog}}

View file

@ -56,7 +56,7 @@ jobs:
id: changelog
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -66,6 +66,48 @@ jobs:
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)"
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
with:
commitMode: true
fromTag: "${{ steps.changelog.outputs.prev_tag }}"
toTag: "${{ steps.changelog.outputs.curr_tag }}"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n## 🔴 #{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature","feat","opt"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix","bug"]
}
,
{
"title": "## 🤖 Github action",
"labels": ["action"]
}
],
"label_extractor": [
{
"pattern": "([^:]*):.*",
"target": "$1",
"on_property": "title",
"flags": "gu"
}
]
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: vars
shell: bash
@ -76,11 +118,13 @@ jobs:
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
echo "::set-output name=release_hm::$(date +'%y%m%d')"
echo "changlog : ${{steps.build_changelog.outputs.changelog}}"
- name: version-file
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "$previousTag">version.txt
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt
cat version.txt
- name: vcpkg install
@ -124,11 +168,7 @@ jobs:
& .github\scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
$name = ${env:archiveName}
echo "::set-output name=packageName::$name"
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
with:
commitMode: true
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
@ -136,7 +176,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -165,6 +205,9 @@ jobs:
CHANGES:
${{ steps.changelog.outputs.changelog }}
----------------
${{steps.build_changelog.outputs.changelog}}
- name: upload goldendict.exe only
@ -173,7 +216,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/${{ env.targetName }}
asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-${{ env.targetName }}
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -184,7 +227,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/GoldenDict.pdb
asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-GoldenDict.pdb
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -203,13 +246,12 @@ jobs:
cd ${{ steps.package.outputs.packageName }}
ls *.exe
- name: upload goldendict installer
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe
asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}

View file

@ -59,7 +59,7 @@ jobs:
id: changelog
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
@ -69,6 +69,8 @@ jobs:
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=changelog::$(echo "$CHANGELOG")"
echo "::set-output name=prev_tag::$previousTag"
echo "::set-output name=curr_tag::$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p)"
- name: Set outputs
id: vars
@ -83,8 +85,8 @@ jobs:
- name: version-file
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "$previousTag">version.txt
current_tag=$(git tag --sort=-creatordate | grep "v.*" | sed -n 1p |cut -c 2-)
echo "$current_tag">version.txt
- uses: ilammy/msvc-dev-cmd@v1
# msvc编译
@ -119,6 +121,36 @@ jobs:
uses: mikepenz/release-changelog-builder-action@v3
with:
commitMode: true
fromTag: ${{ steps.changelog.outputs.prev_tag }}
toTag: "${{ steps.changelog.outputs.curr_tag }}"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n## 🔴 #{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature","feat","opt"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix","bug"]
}
,
{
"title": "## 🤖 Github action",
"labels": ["action"]
}
],
"label_extractor": [
{
"pattern": "([^:]*):.*",
"target": "$1",
"on_property": "title",
"flags": "gu"
}
]
}
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
@ -126,7 +158,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -157,6 +189,9 @@ jobs:
CHANGES:
${{ steps.changelog.outputs.changelog }}
----------------
${{steps.build_changelog.outputs.changelog}}
- name: upload goldendict.exe only
# if: startsWith(github.event.ref, 'refs/tags/')
@ -165,7 +200,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/${{ env.targetName }}
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
@ -193,7 +228,7 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe
asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}