mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
521c359b24
* opt: do not need to reload webview when initialize dictionaries During this phase ,the webview has not existed yet
189 lines
6.8 KiB
YAML
189 lines
6.8 KiB
YAML
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.2, 6.6.3 ]
|
|
qt_arch: [win64_msvc2019_64]
|
|
env:
|
|
version: 24.05.13
|
|
versionSuffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'NextNameHere' }}
|
|
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 .. |