-
Notifications
You must be signed in to change notification settings - Fork 30
171 lines (139 loc) · 6.55 KB
/
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
166
167
168
169
name: Build
on:
push:
branches: [ "master" ]
tags:
- 'v*'
pull_request:
branches: [ "master" ]
workflow_dispatch:
env:
BUILD_TYPE: Release
wxBUILD_SHARED: OFF
wxBUILD_USE_STATIC_RUNTIME: ON
jobs:
create_release:
name: Create Release if Needed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- if: contains(github.ref, 'refs/tags/')
name: Get Tag Message
id: get_tag_message
run: |
cd ${{github.workspace}}
git fetch --tags --force
echo "TAG_MESSAGE<<EOF" >> "$GITHUB_OUTPUT"
echo "$(git for-each-ref ${{github.ref}} --format='%(contents)')" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- if: contains(github.ref, 'refs/tags/')
name: Prepare Release
uses: softprops/action-gh-release@v1
with:
name: Delta Patcher ${{ github.ref_name }}
body: ${{ steps.get_tag_message.outputs.TAG_MESSAGE }}
draft: false
prerelease: false
generate_release_notes: false
build_release:
name: Build
needs: create_release
strategy:
matrix:
include:
- os: ubuntu-20.04
release_package: linuxGTK3_bin_x86_64
- os: macos-11
release_package: macos11+_bin_universal
- os: windows-2022
release_package_64: windows_bin_x86_64
release_package_32: windows_bin_x86
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- if: startsWith(matrix.os, 'ubuntu')
name: Pull dependencies
run: sudo apt install -y build-essential cmake git libgtk-3-dev
- if: startsWith(matrix.os, 'windows')
name: Configure CMake Windows
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DwxBUILD_SHARED=${{env.wxBUILD_SHARED}} -DwxBUILD_USE_STATIC_RUNTIME=${{env.wxBUILD_USE_STATIC_RUNTIME}}
- if: startsWith(matrix.os, 'windows')
name: Configure CMake Windows 32 bit
run: cmake -B ${{github.workspace}}/build32 -A Win32 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DwxBUILD_SHARED=${{env.wxBUILD_SHARED}} -DwxBUILD_USE_STATIC_RUNTIME=${{env.wxBUILD_USE_STATIC_RUNTIME}}
- if: startsWith(matrix.os, 'ubuntu')
name: Configure CMake Linux
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DwxBUILD_SHARED=${{env.wxBUILD_SHARED}}
- if: startsWith(matrix.os, 'macOS')
name: Configure CMake MacOS
run: cmake -B ${{github.workspace}}/build -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DwxBUILD_SHARED=${{env.wxBUILD_SHARED}} -DwxBUILD_USE_STATIC_RUNTIME=${{env.wxBUILD_USE_STATIC_RUNTIME}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 2
- if: startsWith(matrix.os, 'windows')
name: Build Windows 32
run: cmake --build ${{github.workspace}}/build32 --config ${{env.BUILD_TYPE}} --parallel 2
- if: startsWith(matrix.os, 'windows')
name: Package Windows
run: |
cp ${{github.workspace}}/CHANGELOG.txt ${{github.workspace}}/build/app/
cp ${{github.workspace}}/CHANGELOG.txt ${{github.workspace}}/build32/app/
cp ${{github.workspace}}/build/app/Release/DeltaPatcher.exe ${{github.workspace}}/build/app/
cp ${{github.workspace}}/build32/app/Release/DeltaPatcher.exe ${{github.workspace}}/build32/app/
cd ${{github.workspace}}/build/app/
Compress-Archive -Path DeltaPatcher.exe,CHANGELOG.txt -Destination ${{ matrix.release_package_64 }}.zip
cd ${{github.workspace}}/build32/app/
Compress-Archive -Path DeltaPatcher.exe,CHANGELOG.txt -Destination ${{ matrix.release_package_32 }}.zip
- if: startsWith(matrix.os, 'ubuntu')
name: Package Linux
run: |
cp ${{github.workspace}}/CHANGELOG.txt ${{github.workspace}}/build/app/
cd ${{github.workspace}}/build/app/
strip -s DeltaPatcher
zip ${{ matrix.release_package }}.zip DeltaPatcher CHANGELOG.txt
- if: startsWith(matrix.os, 'macOS')
name: Package MacOS
run: |
cp ${{github.workspace}}/CHANGELOG.txt ${{github.workspace}}/build/app
cd ${{github.workspace}}/build/app
zip -r ${{ matrix.release_package }}.zip DeltaPatcher.app/ CHANGELOG.txt
- if: startsWith(matrix.os, 'windows')
name: Upload artifacts Windows x86_64
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.release_package_64 }}
path: ${{github.workspace}}/build/app/${{ matrix.release_package_64 }}.zip
- if: startsWith(matrix.os, 'windows')
name: Upload artifacts Windows x86
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.release_package_32 }}
path: ${{github.workspace}}/build32/app/${{ matrix.release_package_32 }}.zip
- if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS')
name: Upload artifacts Linux and MacOS
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.release_package }}
path: ${{github.workspace}}/build/app/${{ matrix.release_package }}.zip
- if: contains(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
name: Define Asset Path Windows
id: asset_path_win
run: |
$ass_path_64 = "${{github.workspace}}/build/app/${{ matrix.release_package_64 }}.zip" -replace '\\','/'
echo "ASSET_PATH_64=$ass_path_64" >> $env:GITHUB_OUTPUT
$ass_path_32 = "${{github.workspace}}/build32/app/${{ matrix.release_package_32 }}.zip" -replace '\\','/'
echo "ASSET_PATH_32=$ass_path_32" >> $env:GITHUB_OUTPUT
- if: contains(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
name: Upload Release Assets Windows
uses: softprops/action-gh-release@v1
with:
files: |
${{ steps.asset_path_win.outputs.ASSET_PATH_64 }}
${{ steps.asset_path_win.outputs.ASSET_PATH_32 }}
- if: contains(github.ref, 'refs/tags/') && !startsWith(matrix.os, 'windows')
name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: ${{github.workspace}}/build/app/${{ matrix.release_package }}.zip