-
-
Notifications
You must be signed in to change notification settings - Fork 5
183 lines (157 loc) · 5.68 KB
/
build_all.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: build_all
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
TOOL_NAME: Tuw
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.check-tag.outputs.tag }}
wx_version: ${{ steps.wx-version.outputs.version }}
steps:
- name: Check tag
id: check-tag
run: |
if [[ ${{ github.ref }} == refs/tags/v* ]]; then
TAG=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
else
TAG=$(echo ${{ github.sha }} | cut -c1-7)
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
shell: bash
- uses: actions/checkout@v4
- name: Create Release Draft
id: create-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.check-tag.outputs.tag }}
name: ${{ steps.check-tag.outputs.tag }}
body: |
## Changelog
- First Change
- Second Change
draft: true
prerelease: false
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: ""
arch_suffix: -x64
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: ARM
arch_suffix: -arm64
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: UCRT
arch_suffix: 10-x64
- os: macos-14
exe_ext: ""
zip_ext: tar.xz
arch: ""
arch_suffix: ""
name: build-${{ matrix.os }}${{ matrix.arch_suffix }}
runs-on: ${{ matrix.os }}
needs: setup
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Meson for Windows
if: runner.os == 'Windows'
run: pip install meson
- name: Install Meson for Unix
if: runner.os != 'Windows'
run: pip3 install meson ninja
- name: Prepare MSVC for Windows
if: runner.os == 'Windows'
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
- name: Build exe for Windows
if: runner.os == 'Windows'
run: batch_files/build.bat Release ${{ matrix.arch }}
- name: Build exe for Unix
if: runner.os != 'Windows'
run: bash shell_scripts/build.sh Release
- name: Show info about exe
run: bash shell_scripts/exe_info.sh build/Release${{ matrix.arch }}/${{ env.TOOL_NAME }}${{ matrix.exe_ext }}
shell: bash
- name: Copy files
run: |
mkdir -p archive/${{ env.TOOL_NAME }}
cp build/Release${{ matrix.arch }}/${{ env.TOOL_NAME }}${{ matrix.exe_ext }} archive/${{ env.TOOL_NAME }}
cp examples/other_features/help/gui_definition.json archive/${{ env.TOOL_NAME }}
cp docs/changelog.txt archive/${{ env.TOOL_NAME }}
cp license.txt archive/${{ env.TOOL_NAME }}
shell: bash
- name: Archive release for Windows
if: runner.os == 'Windows'
run: |
cd archive/${{ env.TOOL_NAME }}
powershell Compress-Archive -Force -Path * -Destination ../${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}${{ matrix.arch_suffix }}.${{ matrix.zip_ext }}
- name: Archive release for Unix
if: runner.os != 'Windows'
run: |
cd archive
tar -Jcvf ${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}${{ matrix.arch_suffix }}.${{ matrix.zip_ext }} ${{ env.TOOL_NAME }}
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.setup.outputs.tag }} archive/${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}${{ matrix.arch_suffix }}.${{ matrix.zip_ext }}
build-ubuntu:
name: build-ubuntu-${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
arch: [ x64, arm64 ]
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Build x64 version on Ubuntu 20.04
if : matrix.arch == 'x64'
run: |
sudo apt-get update
docker build -t tuw_ubuntu -f docker/ubuntu.dockerfile ./
- name: Build ARM64 version on Ubuntu 20.04
if : matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static binfmt-support
docker buildx build --platform linux/arm64 -t tuw_ubuntu -f docker/ubuntu.dockerfile ./
- name: Copy files
run: |
docker run --name tuw_ubuntu tuw_ubuntu
docker cp tuw_ubuntu:/Tuw/build/Release/${{ env.TOOL_NAME }} ./
mkdir -p archive/${{ env.TOOL_NAME }}
cp ${{ env.TOOL_NAME }} archive/${{ env.TOOL_NAME }}
cp examples/other_features/help/gui_definition.json archive/${{ env.TOOL_NAME }}
cp docs/changelog.txt archive/${{ env.TOOL_NAME }}
cp license.txt archive/${{ env.TOOL_NAME }}
shell: bash
- name: Show info about exe
run: bash shell_scripts/exe_info.sh ${{ env.TOOL_NAME }}
shell: bash
- name: Archive release for Unix
run: |
cd archive
tar -Jcvf ${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}-${{ matrix.arch }}.tar.xz ${{ env.TOOL_NAME }}
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.setup.outputs.tag }} archive/${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}-${{ matrix.arch }}.tar.xz