-
Notifications
You must be signed in to change notification settings - Fork 4
165 lines (147 loc) · 6.89 KB
/
generate-bundles-and-release.yml
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
name: Generate Bundles and Release
on:
push:
tags:
- "v*"
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:
jobs:
Build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get DiffScope Bridge Target
shell: pwsh
run: |
$target = (Get-Content scripts/setup/modules.json | ConvertFrom-Json).'diffscope-bridge'
Write-Output DIFFSCOPE_BRIDGE_REPO=$($target.repository) >> $env:GITHUB_ENV
Write-Output DIFFSCOPE_BRIDGE_REF=$($target.ref) >> $env:GITHUB_ENV
- name: Restore DiffScope Bridge from cache
id: cache_diffscope_bridge
uses: actions/cache/restore@v4
with:
path: scripts/setup/diffscope-bridge
key: ${{ runner.os }}-diffscope-bridge-${{ env.DIFFSCOPE_BRIDGE_REPO }}-${{ env.DIFFSCOPE_BRIDGE_REF }}
- name: Checkout DiffScope Bridge
uses: actions/checkout@v4
if: steps.cache_diffscope_bridge.outputs.cache-hit != 'true'
with:
repository: ${{ env.DIFFSCOPE_BRIDGE_REPO }}
ref: ${{ env.DIFFSCOPE_BRIDGE_REF }}
path: scripts/setup/diffscope-bridge
submodules: recursive
- name: Initialize Building Environment
uses: ./.github/actions/init-build
with:
os: ${{ matrix.os }}
- name: Build DiffScope
shell: pwsh
run: |
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT_DIR }}/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_APPLOCAL_DEPS:BOOL=FALSE `
-DQMSETUP_APPLOCAL_DEPS_PATHS_DEBUG="${{ env.VCPKG_ROOT_DIR }}/installed/${{ env.VCPKG_TRIPLET }}/debug/${{ matrix.os == 'windows-latest' && 'bin' || 'lib' }}" `
-DQMSETUP_APPLOCAL_DEPS_PATHS_RELEASE="${{ env.VCPKG_ROOT_DIR }}/installed/${{ env.VCPKG_TRIPLET }}/${{ matrix.os == 'windows-latest' && 'bin' || 'lib' }}" `
-DCK_ENABLE_CONSOLE:BOOL=FALSE `
-DCK_WIN_APPLOCAL_DEPS:BOOL=TRUE `
-DTALCS_DEVICE_ENABLE_ASIO:BOOL=ON `
-DTALCS_ASIOSDK_DIR=${{ env.ASIOSDK_DIR }} `
-DCMAKE_INSTALL_PREFIX=installed
cmake --build build --target all
cmake --build build --target install
Write-Output DIFFSCOPE_INSTALLED_DIR=$(Resolve-Path -Path installed) >> $env:GITHUB_ENV
- name: Build DiffScope Bridge
shell: pwsh
if: steps.cache_diffscope_bridge.outputs.cache-hit != 'true'
run: |
cd scripts/setup/diffscope-bridge
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT_DIR }}/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_INSTALLED_DIR="${{ env.VCPKG_ROOT_DIR }}/bridge_installed" `
-DVCPKG_MANIFEST_MODE:BOOL=OFF `
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET_STATIC }} `
-DTALCS_DSPX:BOOL=ON
cmake --build build --target all
- name: Store DiffScope Bridge artefacts directory
shell: pwsh
run: |
Write-Output DIFFSCOPE_BRIDGE_ARTEFACTS_DIR=$(Resolve-Path -Path scripts/setup/diffscope-bridge/build/DiffScopeBridge_artefacts/Release) >> $env:GITHUB_ENV
- name: Save DiffScope Bridge to cache
uses: actions/cache/save@v4
with:
path: scripts/setup/diffscope-bridge
key: ${{ runner.os }}-diffscope-bridge-${{ env.DIFFSCOPE_BRIDGE_REPO }}-${{ env.DIFFSCOPE_BRIDGE_REF }}
- name: Set binary name
shell: pwsh
run: |
Write-Output BINARY_NAME=diffscope-$('${{ env.VCPKG_TRIPLET }}'.replace('osx', 'macos'))-${{ github.ref_type == 'tag' && github.ref_name || github.sha }} >> $env:GITHUB_ENV
- name: Create installer (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/jrsoftware/issrc/f59a90485af28067626e60ef7e42336e00ae7472/Files/Languages/Unofficial/ChineseSimplified.isl' -OutFile ChineseSimplified.isl
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/jrsoftware/issrc/e5e138e67bacd650650eac489fa861274a4b81ce/Files/Languages/Unofficial/ChineseTraditional.isl' -OutFile ChineseTraditional.isl
Invoke-WebRequest -Uri "https://www.gnu.org/licenses/gpl-3.0.rtf" -OutFile gpl-3.0.rtf
$content = Get-Content build/CMakeCache.txt
$variableValues = @{}
foreach ($line in $content) {
$pattern = "^\s*(.*):(.*)=(.*)$"
if ($line -Match $pattern) {
$key = $matches[1].Trim()
$value = $matches[3].Trim()
$variableValues[$key] = $value
}
}
$env:SETUP_APP_NAME = $variableValues.CMAKE_PROJECT_NAME
$env:SETUP_APP_VERSION = $variableValues.CMAKE_PROJECT_VERSION
$env:SETUP_APP_INSTALLED_DIR = $env:DIFFSCOPE_INSTALLED_DIR
$env:SETUP_APP_BRIDGE_ARTEFACTS_DIR = $env:DIFFSCOPE_BRIDGE_ARTEFACTS_DIR
$env:SETUP_MESSAGE_FILES_DIR = Resolve-Path .
$env:SETUP_OUTPUT_DIR = Resolve-Path .
$env:SETUP_OUTPUT_FILE_BASE = $env:BINARY_NAME
$env:GPL3_LICENSE_PATH = Resolve-Path -Path gpl-3.0.rtf
ISCC.exe scripts/setup/windows/setup.iss
Write-Output PACKAGE_PATH=$(Resolve-Path -Path "$env:BINARY_NAME.exe") >> $env:GITHUB_ENV
- name: Create DMG bundle (macOS)
if: matrix.os == 'macos-latest'
shell: pwsh
run: |
cd scripts/setup/macos
Invoke-WebRequest -Uri "http://s.sudre.free.fr/Software/files/Packages.dmg" -OutFile Packages.dmg
mkdir Packages
hdiutil attach -mountpoint Packages Packages.dmg
sudo installer -pkg 'Packages/Install Packages.pkg' -target /
Invoke-WebRequest -Uri "https://www.gnu.org/licenses/gpl-3.0.rtf" -OutFile gpl-3.0.rtf
ln -s $env:DIFFSCOPE_BRIDGE_ARTEFACTS_DIR diffscope-bridge-artefacts
packagesbuild diffscope-bridge-dist.pkgproj
npm install
node create-dmg.js $env:DIFFSCOPE_INSTALLED_DIR/DiffScope.app 'DiffScope Bridge.pkg' "$env:BINARY_NAME.dmg"
Write-Output PACKAGE_PATH=$(Resolve-Path -Path "$env:BINARY_NAME.dmg") >> $env:GITHUB_ENV
- name: Upload release file
uses: actions/upload-artifact@v4
with:
name: ${{ env.BINARY_NAME }}
path: ${{ env.PACKAGE_PATH }}
Release:
runs-on: ubuntu-latest
needs: Build
if: github.event_name == 'push'
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
diffscope-*/*