-
Notifications
You must be signed in to change notification settings - Fork 7
113 lines (97 loc) · 3.7 KB
/
release.yml
File metadata and controls
113 lines (97 loc) · 3.7 KB
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
name: Build and Release
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build pandoc mingw-w64 wine64 zip
pip3 install --user meson
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build and test (native, meson fallback)
run: |
meson setup build
meson compile -C build
meson test -C build --print-errorlogs
- name: Cross-compile for Windows
run: |
cat > /tmp/cross-mingw64.ini <<'EOF'
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
exe_wrapper = 'wine'
pkg-config = 'pkg-config'
[built-in options]
default_library = 'shared'
[properties]
sys_root = '/usr/x86_64-w64-mingw32'
pkg_config_libdir = '/nonexistent'
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
EOF
meson setup buildwin --cross-file /tmp/cross-mingw64.ini --buildtype=release -Ddebug=true
meson compile -C buildwin
- name: Test Windows build under wine
run: meson test -C buildwin --print-errorlogs
- name: Extract version
id: version
run: |
ver=$(meson introspect build --projectinfo | python3 -c 'import sys,json; print(json.load(sys.stdin)["version"])')
echo "version=${ver}" >> "$GITHUB_OUTPUT"
echo "project=parse_args-${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Create source tarball
run: |
project="${{ steps.version.outputs.project }}"
# Generate README.md from docs
meson compile -C build readme
cp build/doc/README.md README.md
# Copy workspace dereferencing symlinks, then strip build artifacts
cp -aL . "/tmp/${project}"
find "/tmp/${project}" -name '.git' -exec rm -rf {} +
rm -rf "/tmp/${project}/.github"
rm -rf "/tmp/${project}/build" "/tmp/${project}/buildwin"
rm -rf "/tmp/${project}/subprojects/packagecache"
rm -rf "/tmp/${project}/subprojects/tcl"
rm -rf "/tmp/${project}/subprojects/libtommath-"*
rm -rf "/tmp/${project}/subprojects/.wraplock"
tar czf "/tmp/${project}.tar.gz" -C /tmp "${project}"
cd /tmp && zip -rq "${project}-source.zip" "${project}"
- name: Package Windows binaries
run: |
pkg_dir="parse_args-${{ steps.version.outputs.version }}"
mkdir -p "/tmp/win/${pkg_dir}"
cp buildwin/teabase/*parse_args.dll "/tmp/win/${pkg_dir}/"
cp buildwin/teabase/pkgIndex.tcl "/tmp/win/${pkg_dir}/"
cp buildwin/doc/parse_args.html "/tmp/win/${pkg_dir}/parse_args.html"
cd /tmp/win
zip -r "/tmp/${{ steps.version.outputs.project }}-windows-x86_64.zip" "${pkg_dir}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
/tmp/${{ steps.version.outputs.project }}.tar.gz
/tmp/${{ steps.version.outputs.project }}-source.zip
/tmp/${{ steps.version.outputs.project }}-windows-x86_64.zip
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
draft: false
prerelease: false
generate_release_notes: true
files: |
/tmp/${{ steps.version.outputs.project }}.tar.gz
/tmp/${{ steps.version.outputs.project }}-source.zip
/tmp/${{ steps.version.outputs.project }}-windows-x86_64.zip