File: windows.yml

package info (click to toggle)
goldendict-webengine 23.02.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,148 kB
  • sloc: cpp: 58,537; javascript: 9,942; ansic: 9,242; xml: 41; makefile: 15; sh: 9
file content (184 lines) | stat: -rw-r--r-- 7,703 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Windows
concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
on: 
  # workflow_run:
  #   workflows: [AutoTag]
  #   types: [completed]
  workflow_dispatch:
  push:
    branches:
      - dev
      - master
      # - staged
    paths-ignore:
      - 'docs/**'
      - ".github/**"
      - "howto/**"
      - "*.md"
      - ".clang-format"      

jobs:
  build:
    name: Build
    # 运行平台, windows-latest目前是windows server 2019 
    # 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-2019]
        qt_ver: [5.15.2]
        qt_arch: [win64_msvc2019_64]
    env:
      targetName: GoldenDict.exe
      version: 23.02.06
      version-suffix: LanternFestival
      prerelease: false
    # 步骤
    steps:
      # 安装Qt
      - name: Install Qt
        # 使用外部action。这个action专门用来安装Qt
        uses: jurplel/install-qt-action@v3
        with:
          # Version of Qt to install
          version: ${{ matrix.qt_ver }}
          # Target platform for build
          # target: ${{ matrix.qt_target }}
          arch: ${{ matrix.qt_arch }}
          cached: 'false'
          modules: qtwebengine
      # 拉取代码
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: changelog
        id: changelog
        shell: bash
        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=changelog::$(echo "$CHANGELOG")"

      - name: Set outputs
        id: vars
        shell: bash
        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: version-file
        shell: bash
        run: |   
          previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
          echo "$previousTag">version.txt

      - uses: ilammy/msvc-dev-cmd@v1
      # msvc编译
      - name: msvc-build goldendict
        id: build
        shell: cmd
        run: |
          # call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
          qmake "CONFIG+=zim_support" CONFIG+=release CONFIG+=use_iconv
          nmake

          echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
          echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
          echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
          echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
          echo QTDIR=%Qt5_DIR% >> %GITHUB_ENV%

      # 打包 
      - name: package
        id: package      
        env:
          archiveName: GoldenDict-Windows.${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.release_time }}
          msvcArch: ${{ matrix.msvc_arch }}
        shell: pwsh
        run: |
          & .github\scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
           $name = ${env:archiveName}
           echo "::set-output name=packageName::$name" 

      - name: uploadRelease
        # if: startsWith(github.event.ref, 'refs/tags/')
        uses: svenstaro/upload-release-action@v2
        with:
          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-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.changelog.outputs.changelog }}  
      - name: upload goldendict.exe only
        # if: startsWith(github.event.ref, 'refs/tags/')
        uses: svenstaro/upload-release-action@v2
        with:
          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-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
          prerelease: ${{env.prerelease}}
            

      - name: copy nsis 
        shell: bash
        run: |
          ls -al
          cp tools/nsis/GoldenDict.nsi ${{ steps.package.outputs.packageName }}/
      - name: Create installer
        uses: joncloud/makensis-action@v3.6
        with:
          arguments: "/V3"
          script-file: ${{ steps.package.outputs.packageName }}/GoldenDict.nsi
      - name: make installer 
        run: |
          ls *.exe
          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-v22-Install.exe
          asset_name: ${{ matrix.qt_ver }}-GoldenDict-v${{env.version}}-${{env.version-suffix}}-Installer.exe
          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}}