mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 16:04:06 +00:00
action: merge all release
workflows into one
This commit is contained in:
parent
ccbf8b7e55
commit
5173653b63
271
.github/workflows/Release-all.yml
vendored
Normal file
271
.github/workflows/Release-all.yml
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
name: Release All
|
||||
env:
|
||||
version: 24.11.0
|
||||
prerelease: ${{ !contains(github.ref_name,'master') }}
|
||||
versionSuffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
- experimental
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- "howto/**"
|
||||
- "*.md"
|
||||
- ".clang-format"
|
||||
jobs:
|
||||
build_macOS:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-13,macos-14]
|
||||
qt_ver: [ 6.6.3, 6.7.3 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install \
|
||||
bzip2 \
|
||||
create-dmg \
|
||||
hunspell \
|
||||
libiconv \
|
||||
libogg \
|
||||
libvorbis \
|
||||
libzim \
|
||||
lzip \
|
||||
ninja \
|
||||
opencc \
|
||||
xapian
|
||||
|
||||
git clone https://github.com/xiaoyifang/eb.git
|
||||
cd eb && ./configure && make -j 8 && sudo make install && cd ..
|
||||
- uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ matrix.qt_ver }}
|
||||
arch: clang_64
|
||||
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build_dir
|
||||
cmake -S . -B build_dir \
|
||||
-G Ninja \
|
||||
-DWITH_FFMPEG_PLAYER=OFF \
|
||||
-DWITH_TTS=OFF \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="12.0"
|
||||
cmake --build build_dir
|
||||
- name: Package
|
||||
run: |
|
||||
cmake --install build_dir/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macOS-${{ matrix.os }}-Qt${{ matrix.qt_ver }}
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
path: '*.dmg'
|
||||
|
||||
build_Windows:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-2022]
|
||||
qt_ver: [ 6.6.3, 6.7.3 ]
|
||||
steps:
|
||||
- uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ matrix.qt_ver }}
|
||||
arch: win64_msvc2019_64
|
||||
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
|
||||
setup-python: 'false'
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build
|
||||
id: build
|
||||
run: |
|
||||
# Launch-VsDevShell also provides Ninja
|
||||
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' `
|
||||
-SkipAutomaticLocation -Arch amd64 -HostArch amd64
|
||||
New-Item -Path './build_dir' -ItemType Directory
|
||||
|
||||
# RelWithDebInfo + msvc's = .pdb file beside program file.
|
||||
cmake -S . -B "./build_dir" `
|
||||
-G Ninja `
|
||||
-DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" `
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||
-DWITH_FFMPEG_PLAYER=OFF `
|
||||
-DWITH_VCPKG_BREAKPAD=ON
|
||||
cmake --build "./build_dir"
|
||||
- name: Package
|
||||
run: |
|
||||
cd './build_dir'
|
||||
cpack --verbose --trace
|
||||
cd ..
|
||||
- name: Move files
|
||||
shell: bash
|
||||
run: |
|
||||
namePrefix=$(basename "$(ls ./build_dir/*.7z)" .7z)
|
||||
|
||||
# note the name will ensure `installer` ranked higher after sorting
|
||||
cd ./build_dir
|
||||
mv "${namePrefix}.7z" "${namePrefix}-Windows-installer.7z"
|
||||
mv "${namePrefix}.exe" "${namePrefix}-Windows-installer.exe"
|
||||
mv ./goldendict/goldendict.exe "./${namePrefix}-Windows-main-exe-file-only.exe"
|
||||
mv ./goldendict/goldendict.pdb "./${namePrefix}-Windows-pdb-debug-file.pdb"
|
||||
cd ..
|
||||
ls -R
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Windows-Qt${{ matrix.qt_ver }}
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
path: |
|
||||
./build_dir/*.exe
|
||||
./build_dir/*.7z
|
||||
./build_dir/*.pdb
|
||||
|
||||
generate_other_staffs:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
newTag: ${{ steps.getNewTag.outputs.newTag }}
|
||||
releaseTitle: ${{steps.getReleaseTitle.outputs.releaseTitle}}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # need all tags to genearte changelog
|
||||
- name: Get git short SHA
|
||||
id: shortSHA
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
- name: Get changelog tags
|
||||
id: changelogTags
|
||||
run: |
|
||||
if [[ '${{env.prerelease}}' == 'true' ]]
|
||||
then
|
||||
echo "This is a pre-release"
|
||||
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
|
||||
currentTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)
|
||||
else
|
||||
echo "This is not a pre-release"
|
||||
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
|
||||
currentTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)
|
||||
fi
|
||||
|
||||
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
|
||||
echo "curr_tag=$currentTag" >> $GITHUB_OUTPUT
|
||||
echo "previousTag : $previousTag"
|
||||
echo "currentTag : $currentTag"
|
||||
- name: Get new tag
|
||||
id: getNewTag
|
||||
run: |
|
||||
echo "newTag=v${{ env.version }}-${{ env.versionSuffix }}.${{ steps.shortSHA.outputs.sha_short }}" >> $GITHUB_OUTPUT
|
||||
- name: Build Changelog
|
||||
id: build_changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3
|
||||
with:
|
||||
commitMode: false
|
||||
fromTag: ${{ steps.changelogTags.outputs.prev_tag }}
|
||||
toTag: "${{ steps.changelogTags.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": "## 🤖 DevOps",
|
||||
"labels": ["action"]
|
||||
}
|
||||
,
|
||||
{
|
||||
"title": "## 🧼 Clean Code",
|
||||
"labels": ["clean","refactor"]
|
||||
}
|
||||
|
||||
],
|
||||
"label_extractor": [
|
||||
{
|
||||
"pattern": "([^:]*):.*",
|
||||
"target": "$1",
|
||||
"on_property": "title",
|
||||
"flags": "gu"
|
||||
}
|
||||
]
|
||||
}
|
||||
- name: Get changelog.txt
|
||||
run: |
|
||||
cat <<HEREDOC > changelog.txt
|
||||
[Install instructions for Windows, macOS and Linux](https://xiaoyifang.github.io/goldendict-ng/install/).
|
||||
|
||||
Filename pattern: GoldenDict-ng-[version]-[Qt version]-[system name]...
|
||||
|
||||
For Linux, the released version is on Flathub → [io.github.xiaoyifang.goldendict_ng](https://flathub.org/apps/io.github.xiaoyifang.goldendict_ng).
|
||||
|
||||
Based on branch: ${{ github.ref_name }}
|
||||
#### Changes
|
||||
${{ steps.build_changelog.outputs.changelog }}
|
||||
HEREDOC
|
||||
- name: Get release title
|
||||
id: getReleaseTitle
|
||||
run: |
|
||||
if [[ '${{ env.prerelease }}' == 'true' ]]
|
||||
then
|
||||
echo "releaseTitle=Daily build v${{env.version}}-${{ steps.shortSHA.outputs.sha_short }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "releaseTitle=v${{ env.version }}-${{ env.versionSuffix }}.${{ steps.shortSHA.outputs.sha_short }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: changelog.txt
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
path: ./changelog.txt
|
||||
|
||||
publish:
|
||||
needs: [build_macOS, build_Windows, generate_other_staffs]
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
newTag: ${{ needs.generate_other_staffs.outputs.newTag }}
|
||||
releaseTitle: ${{ needs.generate_other_staffs.outputs.releaseTitle }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
- name: List all files
|
||||
run: ls -R
|
||||
- name: Create new tag
|
||||
run: |
|
||||
if [[ '${{ env.prerelease }}' == 'true' ]]
|
||||
then
|
||||
gh release create '${{ env.newTag }}' \
|
||||
-t '${{ env.releaseTitle }}' \
|
||||
--target '${{ github.ref_name }}' \
|
||||
--notes-file=./changelog.txt \
|
||||
--latest=false \
|
||||
--prerelease \
|
||||
--repo ${GITHUB_REPOSITORY}
|
||||
else
|
||||
gh release create '${{ env.newTag }}' \
|
||||
-t '${{ env.releaseTitle }}' \
|
||||
--target '${{ github.ref_name }}' \
|
||||
--notes-file=./changelog.txt \
|
||||
--latest=true \
|
||||
--repo ${GITHUB_REPOSITORY}
|
||||
fi
|
||||
- name: Upload artifacts
|
||||
run: |
|
||||
gh release upload '${{ env.newTag }}' --repo ${GITHUB_REPOSITORY} --clobber \
|
||||
*.7z *.exe *.pdb *.dmg
|
42
.github/workflows/release-AutoTag.yml
vendored
42
.github/workflows/release-AutoTag.yml
vendored
|
@ -1,42 +0,0 @@
|
|||
name: Release AutoTag
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
- experimental
|
||||
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- "howto/**"
|
||||
- "*.md"
|
||||
- ".clang-format"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
version: 24.11.0
|
||||
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
|
||||
prerelease: ${{ !contains(github.ref_name,'master') }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: set git short sha
|
||||
id: vars
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
|
||||
echo "release_hm=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
|
||||
- name: Bump version and push tag
|
||||
id: tag_version
|
||||
uses: mathieudutour/github-tag-action@v6.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
custom_tag: ${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.sha_short }}
|
173
.github/workflows/release-macos-homebrew.yml
vendored
173
.github/workflows/release-macos-homebrew.yml
vendored
|
@ -1,173 +0,0 @@
|
|||
name: Release macOS
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
- experimental
|
||||
# - staged
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
# - ".github/**"
|
||||
- "howto/**"
|
||||
- "*.md"
|
||||
- ".clang-format"
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-13,macos-14]
|
||||
qt_ver: [ 6.7.3,6.6.3 ]
|
||||
qt_arch: [clang_64]
|
||||
env:
|
||||
targetName: GoldenDict
|
||||
version: 24.11.0
|
||||
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
|
||||
prerelease: ${{ !contains(github.ref_name,'master') }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Set outputs
|
||||
id: githash
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: install deps on macos
|
||||
run: |
|
||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=TRUE
|
||||
brew install cmake ninja pkg-config create-dmg \
|
||||
opencc libzim hunspell xapian \
|
||||
libiconv libogg libvorbis \
|
||||
lzo bzip2 zstd lzip
|
||||
|
||||
git clone https://github.com/xiaoyifang/eb.git
|
||||
cd eb && ./configure && make -j 8 && sudo make install && cd ..
|
||||
|
||||
- name: version-file
|
||||
shell: bash
|
||||
env:
|
||||
VAR_SUFFIX: ${{env.version-suffix}}
|
||||
VAR_VERSION: ${{env.version}}
|
||||
run: |
|
||||
current_tag=$(git rev-parse --short=8 HEAD)
|
||||
release_date=$(date +'%Y%m%d')
|
||||
echo "$VAR_VERSION-$VAR_SUFFIX.$release_date.$current_tag">version.txt
|
||||
cat version.txt
|
||||
echo "$version"
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: ${{ matrix.qt_ver }}
|
||||
arch: ${{ matrix.qt_arch }}
|
||||
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
|
||||
|
||||
- name: compile
|
||||
run: |
|
||||
mkdir build_dir
|
||||
cmake -S . -B build_dir -G Ninja -DWITH_FFMPEG_PLAYER=OFF -DWITH_TTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_DEPLOYMENT_TARGET="12.0"
|
||||
cmake --build build_dir
|
||||
|
||||
- name: package
|
||||
run: |
|
||||
cmake --install build_dir/
|
||||
- name: changelog
|
||||
id: changelog
|
||||
env:
|
||||
prerelease: ${{env.prerelease}}
|
||||
run: |
|
||||
if [[ "$prerelease" == 'true' ]]
|
||||
then
|
||||
echo "This is a pre-release"
|
||||
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
|
||||
currentTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)
|
||||
else
|
||||
echo "This is not a pre-release"
|
||||
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
|
||||
currentTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)
|
||||
fi
|
||||
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
|
||||
echo "curr_tag=$currentTag" >> $GITHUB_OUTPUT
|
||||
echo "previousTag : $previousTag"
|
||||
echo "currentTag : $currentTag"
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
|
||||
echo "release_date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
|
||||
echo "release_time=$(date +'%H%M%S')" >> $GITHUB_OUTPUT
|
||||
echo "release_time_clock=$(date +'%H:%M:%S')" >> $GITHUB_OUTPUT
|
||||
echo "release_hm=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
|
||||
|
||||
# tag 上传Release
|
||||
- name: "Build Changelog"
|
||||
id: build_changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3
|
||||
with:
|
||||
commitMode: false
|
||||
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"]
|
||||
}
|
||||
,
|
||||
{
|
||||
"title": "## 🧼 Clean Code",
|
||||
"labels": ["clean"]
|
||||
}
|
||||
|
||||
],
|
||||
"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: "*.dmg"
|
||||
file_glob: true
|
||||
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.sha_short }}
|
||||
overwrite: true
|
||||
release_name: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
|
||||
prerelease: ${{env.prerelease}}
|
||||
body: |
|
||||
[Install instructions for Windows, macOS and Linux](https://xiaoyifang.github.io/goldendict-ng/install/).
|
||||
|
||||
Filename pattern: GoldenDict-ng-[version]-[Qt version]-[system name]-...
|
||||
|
||||
For Linux, the released version is on Flathub → [io.github.xiaoyifang.goldendict_ng](https://flathub.org/apps/io.github.xiaoyifang.goldendict_ng).
|
||||
|
||||
Based on branch: ${{github.ref_name}}
|
||||
|
||||
#### Changes
|
||||
|
||||
${{steps.build_changelog.outputs.changelog}}
|
189
.github/workflows/release-windows-vcpkg-cmake.yml
vendored
189
.github/workflows/release-windows-vcpkg-cmake.yml
vendored
|
@ -1,189 +0,0 @@
|
|||
name: Release Windows CMake
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
- experimental
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- "*.md"
|
||||
- ".*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-2022]
|
||||
qt_ver: [ 6.7.3, 6.6.3 ]
|
||||
qt_arch: [win64_msvc2019_64]
|
||||
env:
|
||||
version: 24.11.0
|
||||
versionSuffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
|
||||
prerelease: ${{ !contains(github.ref_name,'master') }}
|
||||
steps:
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: ${{ matrix.qt_ver }}
|
||||
# target: ${{ matrix.qt_target }}
|
||||
arch: ${{ matrix.qt_arch }}
|
||||
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
|
||||
setup-python: 'false'
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Setup changelog
|
||||
id: changelog
|
||||
shell: bash
|
||||
env:
|
||||
prerelease: ${{env.prerelease}}
|
||||
run: |
|
||||
if [[ "$prerelease" == 'true' ]]
|
||||
then
|
||||
echo "This is a pre-release"
|
||||
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
|
||||
currentTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)
|
||||
else
|
||||
echo "This is not a pre-release"
|
||||
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
|
||||
currentTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)
|
||||
fi
|
||||
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
|
||||
echo "curr_tag=$currentTag" >> $GITHUB_OUTPUT
|
||||
echo "previousTag : $previousTag"
|
||||
echo "currentTag : $currentTag"
|
||||
|
||||
- name: "Build Changelog"
|
||||
id: build_changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
commitMode: false
|
||||
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"]
|
||||
}
|
||||
,
|
||||
{
|
||||
"title": "## 🧼 Clean Code",
|
||||
"labels": ["clean"]
|
||||
}
|
||||
|
||||
|
||||
],
|
||||
"label_extractor": [
|
||||
{
|
||||
"pattern": "([^:]*):.*",
|
||||
"target": "$1",
|
||||
"on_property": "title",
|
||||
"flags": "gu"
|
||||
}
|
||||
]
|
||||
}
|
||||
- name: Build binaries
|
||||
id: build
|
||||
run: |
|
||||
# Launch-VsDevShell also provides Ninja
|
||||
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' `
|
||||
-SkipAutomaticLocation -Arch amd64 -HostArch amd64
|
||||
New-Item -Path './build_dir' -ItemType Directory
|
||||
|
||||
# RelWithDebInfo + msvc's = .pdb file beside program file.
|
||||
cmake -S . -B "./build_dir" `
|
||||
-G Ninja `
|
||||
-DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" `
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||
-DWITH_FFMPEG_PLAYER=OFF `
|
||||
-DWITH_VCPKG_BREAKPAD=ON
|
||||
cmake --build "./build_dir"
|
||||
- name: CPack create package
|
||||
run: |
|
||||
cd './build_dir'
|
||||
cpack --verbose --trace
|
||||
cd ..
|
||||
pwd
|
||||
- name: Upload packages
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
$tagName = "v$env:version-$env:versionSuffix.$(git rev-parse --short=8 HEAD)"
|
||||
$releaseName = "v$env:version-$env:versionSuffix.$(date +'%y%m%d').$(git rev-parse --short=8 HEAD)"
|
||||
|
||||
Add-Content -Path ./change_note.txt -Value "
|
||||
[Install instructions for Windows, macOS and Linux](https://xiaoyifang.github.io/goldendict-ng/install/).
|
||||
|
||||
Filename pattern: GoldenDict-ng-[version]-[Qt version]-[system name]-...
|
||||
|
||||
For Linux, the released version is on Flathub → [io.github.xiaoyifang.goldendict_ng](https://flathub.org/apps/io.github.xiaoyifang.goldendict_ng).
|
||||
|
||||
Based on branch: ${{github.ref_name}}
|
||||
|
||||
#### Changes
|
||||
"
|
||||
|
||||
Add-Content -Path ./change_note.txt -Value @'
|
||||
${{steps.build_changelog.outputs.changelog}}
|
||||
'@
|
||||
|
||||
$tagExist = gh api --silent "repos/:owner/:repo/git/refs/tags/${tagName}"
|
||||
if (-not $?) {
|
||||
if ($env:prerelease -eq "true") {
|
||||
gh release create ${tagName} -t ${releaseName} --target ${{github.ref_name}} --notes-file=./change_note.txt --latest=false --prerelease
|
||||
} else {
|
||||
gh release create ${tagName} -t ${releaseName} --target ${{github.ref_name}} --notes-file=./change_note.txt --latest=true
|
||||
}
|
||||
}
|
||||
|
||||
# file name after # is display label
|
||||
|
||||
$namePrefix="GoldenDict-ng-${{env.version}}-Qt${{matrix.qt_ver}}"
|
||||
|
||||
cd './build_dir'
|
||||
gh release upload "${tagName}" "${namePrefix}.7z#${namePrefix}-Windows.7z" --clobber
|
||||
gh release upload "${tagName}" "${namePrefix}.exe#${namePrefix}-Windows-installer.exe" --clobber
|
||||
|
||||
|
||||
- name: Upload Single packages
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
tagName="v${{env.version}}-${{env.versionSuffix}}.$(git rev-parse --short=8 HEAD)"
|
||||
echo $tagName
|
||||
namePrefix="GoldenDict-ng-${{env.version}}-Qt${{matrix.qt_ver}}"
|
||||
|
||||
cd ./build_dir/goldendict
|
||||
|
||||
# rename to avoid conflict with other packages
|
||||
mv goldendict.exe goldendict-Qt${{matrix.qt_ver}}.exe
|
||||
mv goldendict.pdb goldendict-Qt${{matrix.qt_ver}}.pdb
|
||||
|
||||
gh release upload "${tagName}" "goldendict-Qt${{matrix.qt_ver}}.exe#${namePrefix}-Windows-main-exe-file-only.exe" --clobber
|
||||
gh release upload "${tagName}" "goldendict-Qt${{matrix.qt_ver}}.pdb#${namePrefix}-Windows-debug-file.pdb" --clobber
|
||||
cd ..
|
Loading…
Reference in a new issue