goldendict-ng/.github/workflows/macos-homebrew.yml
2022-11-21 20:26:01 +08:00

355 lines
13 KiB
YAML

name: macos-homebrew
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- dev
- master
# - staged
paths-ignore:
- 'docs/**'
- ".github/**"
- "howto/**"
- "*.md"
- ".clang-format"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11,macos-12]
qt_ver: [6.3.2,6.4.1]
qt_arch: [clang_64]
env:
targetName: GoldenDict
version: 22.11.22
version-suffix: LightSnow
prerelease: false
steps:
# macos 11.0 默认环境变了,要指定
- name: prepare env
if: ${{ matrix.os == 'macos-11' }}
run: |
softwareupdate --all --install --force
sudo xcode-select --print-path
sudo xcode-select --switch /Library/Developer/CommandLineTools
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install Qt
uses: xiaoyifang/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
cached: 'false'
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats
setup-python: 'false'
py7zrversion: '==0.18.1'
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set outputs
id: githash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: build macos
run: |
brew install pcre2 harfbuzz freetype
brew install cmake ninja python
brew install automake
brew install autoconf
brew install libtool
brew install opencc
brew install speex
brew install wavpack
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 x265 xvid nasm
brew install speex
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --prefix=/usr/local \
--enable-shared \
--disable-static \
--disable-debug \
--disable-programs \
--disable-network \
--disable-avdevice \
--disable-avfilter \
--disable-swscale \
--disable-network \
--disable-muxers \
--disable-demuxers \
--enable-rdft \
--enable-demuxer=aac \
--enable-demuxer=ac3 \
--enable-demuxer=aiff \
--enable-demuxer=ape \
--enable-demuxer=asf \
--enable-demuxer=flac \
--enable-demuxer=matroska \
--enable-demuxer=mp3 \
--enable-demuxer=mpc \
--enable-demuxer=mov \
--enable-demuxer=mpc8 \
--enable-demuxer=ogg \
--enable-demuxer=tta \
--enable-demuxer=wav \
--enable-demuxer=wv \
--disable-bsfs \
--disable-filters \
--disable-parsers \
--enable-parser=aac \
--enable-parser=ac3 \
--enable-parser=mpegaudio \
--disable-protocols \
--disable-indevs \
--disable-outdevs \
--disable-encoders \
--disable-decoders \
--enable-decoder=eightsvx_exp \
--enable-decoder=eightsvx_fib \
--enable-decoder=aac \
--enable-decoder=aac_latm \
--enable-decoder=ac3 \
--enable-decoder=adpcm_4xm \
--enable-decoder=adpcm_adx \
--enable-decoder=adpcm_afc \
--enable-decoder=adpcm_ct \
--enable-decoder=adpcm_ea \
--enable-decoder=adpcm_ea_maxis_xa \
--enable-decoder=adpcm_ea_r1 \
--enable-decoder=adpcm_ea_r2 \
--enable-decoder=adpcm_ea_r3 \
--enable-decoder=adpcm_ea_xas \
--enable-decoder=adpcm_g722 \
--enable-decoder=adpcm_g726 \
--enable-decoder=adpcm_ima_amv \
--enable-decoder=adpcm_ima_apc \
--enable-decoder=adpcm_ima_dk3 \
--enable-decoder=adpcm_ima_dk4 \
--enable-decoder=adpcm_ima_ea_eacs \
--enable-decoder=adpcm_ima_ea_sead \
--enable-decoder=adpcm_ima_iss \
--enable-decoder=adpcm_ima_oki \
--enable-decoder=adpcm_ima_qt \
--enable-decoder=adpcm_ima_smjpeg \
--enable-decoder=adpcm_ima_wav \
--enable-decoder=adpcm_ima_ws \
--enable-decoder=adpcm_ms \
--enable-decoder=adpcm_sbpro_2 \
--enable-decoder=adpcm_sbpro_3 \
--enable-decoder=adpcm_sbpro_4 \
--enable-decoder=adpcm_swf \
--enable-decoder=adpcm_thp \
--enable-decoder=adpcm_xa \
--enable-decoder=adpcm_yamaha \
--enable-decoder=alac \
--enable-decoder=amrnb \
--enable-decoder=libopencore_amrnb \
--enable-decoder=amrwb \
--enable-decoder=libopencore_amrwb \
--enable-decoder=ape \
--enable-decoder=atrac1 \
--enable-decoder=atrac3 \
--enable-decoder=binkaudio_dct \
--enable-decoder=binkaudio_rdft \
--enable-decoder=bmv_audio \
--enable-decoder=comfortnoise \
--enable-decoder=cook \
--enable-decoder=dsicinaudio \
--enable-decoder=dca \
--enable-decoder=eac3 \
--enable-decoder=flac \
--enable-decoder=g723_1 \
--enable-decoder=g729 \
--enable-decoder=gsm \
--enable-decoder=libgsm \
--enable-decoder=gsm_ms \
--enable-decoder=libgsm_ms \
--enable-decoder=iac \
--enable-decoder=imc \
--enable-decoder=interplay_dpcm \
--enable-decoder=mace3 \
--enable-decoder=mace6 \
--enable-decoder=mlp \
--enable-decoder=mp1 \
--enable-decoder=mp1float \
--enable-decoder=mp2 \
--enable-decoder=mp2float \
--enable-decoder=mp3 \
--enable-decoder=mp3float \
--enable-decoder=mp3adu \
--enable-decoder=mp3adufloat \
--enable-decoder=mp3on4 \
--enable-decoder=mp3on4float \
--enable-decoder=als \
--enable-decoder=mpc7 \
--enable-decoder=mpc8 \
--enable-decoder=mp3*,pcm* \
--enable-decoder=nellymoser \
--enable-decoder=libopus \
--enable-decoder=paf_audio \
--enable-decoder=pcm_alaw \
--enable-decoder=pcm_bluray \
--enable-decoder=pcm_dvd \
--enable-decoder=pcm_f32be \
--enable-decoder=pcm_f32le \
--enable-decoder=pcm_f64be \
--enable-decoder=pcm_f64le \
--enable-decoder=pcm_lxf \
--enable-decoder=pcm_mulaw \
--enable-decoder=pcm_s16be \
--enable-decoder=pcm_s16be_planar \
--enable-decoder=pcm_s16le \
--enable-decoder=pcm_s16le_planar \
--enable-decoder=pcm_s24be \
--enable-decoder=pcm_s24daud \
--enable-decoder=pcm_s24le \
--enable-decoder=pcm_s24le_planar \
--enable-decoder=pcm_s32be \
--enable-decoder=pcm_s32le \
--enable-decoder=pcm_s32le_planar \
--enable-decoder=pcm_s8 \
--enable-decoder=pcm_s8_planar \
--enable-decoder=pcm_u16be \
--enable-decoder=pcm_u16le \
--enable-decoder=pcm_u24be \
--enable-decoder=pcm_u24le \
--enable-decoder=pcm_u32be \
--enable-decoder=pcm_u32le \
--enable-decoder=pcm_u8 \
--enable-decoder=pcm_zork \
--enable-decoder=qcelp \
--enable-decoder=qdm2 \
--enable-decoder=ra_144 \
--enable-decoder=ra_288 \
--enable-decoder=ralf \
--enable-decoder=roq_dpcm \
--enable-decoder=s302m \
--enable-decoder=shorten \
--enable-decoder=sipr \
--enable-decoder=smackaud \
--enable-decoder=sol_dpcm \
--enable-decoder=sonic \
--enable-decoder=libspeex \
--enable-decoder=tak \
--enable-decoder=truehd \
--enable-decoder=truespeech \
--enable-decoder=tta \
--enable-decoder=twinvq \
--enable-decoder=vima \
--enable-decoder=vmdaudio \
--enable-decoder=vorbis \
--enable-decoder=ffwavesynth \
--enable-decoder=wavpack \
--enable-decoder=ws_snd1 \
--enable-decoder=wmalossless \
--enable-decoder=wmapro \
--enable-decoder=wmav1 \
--enable-decoder=wmav2 \
--enable-decoder=wmavoice \
--enable-decoder=xan_dpcm \
--enable-libmp3lame \
--enable-libspeex
make
sudo make install
cd ..
brew install libiconv
brew install lzo bzip2
brew install libogg
brew install zstd lzip
brew install libtiff
brew install libvorbis
brew install hunspell
git clone https://github.com/xiaoyifang/eb.git
cd eb && ./configure && make -j 8 && sudo make install && cd ..
brew install xz lzo
brew install pkg-config
brew install create-dmg
- name: compile
run: |
qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=no_extra_tiff_handler #CONFIG+=no_epwing_support # CONFIG+=no_ffmpeg_player #CONFIG+=no_qtmultimedia_player
make -j8
# # 打包
# - name: package
# run: |
# macdeployqt ${targetName}.app -qmldir=. -verbose=1 -dmg
# 打包
- name: package
run: |
macdeployqt ${targetName}.app -qmldir=. -verbose=1
codesign --force --deep -s - GoldenDict.app
otool -L GoldenDict.app/Contents/MacOS/GoldenDict
# otool -L GoldenDict.app/Contents/Frameworks/lib*
mkdir tmp
mv ${targetName}.app ./tmp
# --background "installer_background.png"
create-dmg --volname "${targetName} Installer" --volicon "icons/macicon.icns" --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "${targetName}.app" 200 190 --hide-extension "${targetName}.app" --app-drop-link 600 185 --skip-jenkins "${targetName}.dmg" tmp/
- name: Generate changelog
if: ${{!env.prerelease}}
id: changelog1
uses: metcalfc/changelog-generator@v3.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short=8 HEAD)"
echo "::set-output name=release_date::$(date +'%Y%m%d')"
echo "::set-output name=release_time::$(date +'%H%M%S')"
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
echo "::set-output name=release_hm::$(date +'%y%m%d')"
- name: changelog
if: $${{env.prerelease}}
id: changelog2
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
# tag 上传Release
- 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-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: Qt5.15.2, Qt6.X
Windows built with: msvc64, Visual studio 2019
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
macos built with: macos-10.15,macos-11.0,clang_64 x86_64
Qt6.X(Universal Build)
Qt5.15.2(Intel Kind)
auto built by github action. use on your on risk:-)
**recommend version**:Qt6.X (with the latest bug fixes and performance enhancements)
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES:
${{ steps.changelog1.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}