-
Notifications
You must be signed in to change notification settings - Fork 18
146 lines (128 loc) · 4.45 KB
/
publish_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
name: Publish Release
on:
push:
tags:
- 'v[0-9]*'
jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up build dependencies
run: |
sudo apt install \
g++ \
g++-multilib-i686-linux-gnu \
mingw-w64 \
cmake
- name: Set up environment
run: |
. "${{ github.workspace }}/info.cfg"
ver="${VERSION}"
pyver="${PYVERSION}"
if [ ! -z ${PKGREV} ] && [ ${PKGREV} -gt 0 ]; then
ver="${ver}-${PKGREV}"
pyver="${pyver}-${PKGREV}"
fi
stage="${{ github.workspace }}/build/stage"
mkdir -p "${stage}"
cp "${{ github.workspace }}/LICENSE.txt" "${stage}"
echo "ver=${ver}" >> $GITHUB_ENV
echo "pyver=${pyver}" >> $GITHUB_ENV
echo "stage=${stage}" >> $GITHUB_ENV
- name: Compile ELF (Linux) 64-bit
run: |
dir_build="${{ github.workspace }}/build/linux64"
mkdir -p "${dir_build}" && cd "${dir_build}"
cmake \
-DSTATIC=ON \
"${{ github.workspace }}"
cmake --build ./
cp bin2header "${{ env.stage }}"
- name: Package ELF (Linux) 64-bit
run: |
pkgname="bin2header_${{ env.ver }}_linux64.zip"
cd "${{ env.stage }}"
zip "${pkgname}" bin2header LICENSE.txt
rm bin2header
- name: Compile ELF (Linux) 32-bit
run: |
dir_build="${{ github.workspace }}/build/linux32"
mkdir -p "${dir_build}" && cd "${dir_build}"
cmake \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-i686-linux-gnu.cmake \
-DSTATIC=ON \
"${{ github.workspace }}"
cmake --build ./
cp bin2header "${{ env.stage }}"
- name: Package ELF (Linux) 32-bit
run: |
pkgname="bin2header_${{ env.ver }}_linux32.zip"
cd "${{ env.stage }}"
zip "${pkgname}" bin2header LICENSE.txt
rm bin2header
- name: Compile PE32 (Windows) 64-bit
run: |
dir_build="${{ github.workspace }}/build/win64"
mkdir -p "${dir_build}" && cd "${dir_build}"
cmake \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-x86_64-w64-mingw32.cmake \
-DSTATIC=ON \
-DEMBED_ICON=ON \
"${{ github.workspace }}"
cmake --build ./
cp bin2header.exe "${{ env.stage }}"
- name: Package PE32 (Windows) 64-bit
run: |
pkgname="bin2header_${{ env.ver }}_win64.zip"
cd "${{ env.stage }}"
zip "${pkgname}" bin2header.exe LICENSE.txt
rm bin2header.exe
- name: Compile PE32 (Windows) 32-bit
run: |
dir_build="${{ github.workspace }}/build/win32"
mkdir -p "${dir_build}" && cd "${dir_build}"
cmake \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-i686-w64-mingw32.cmake \
-DSTATIC=ON \
-DEMBED_ICON=ON \
"${{ github.workspace }}"
cmake --build ./
cp bin2header.exe "${{ env.stage }}"
- name: Package PE32 (Windows) 32-bit
run: |
pkgname="bin2header_${{ env.ver }}_win32.zip"
cd "${{ env.stage }}"
zip "${pkgname}" bin2header.exe LICENSE.txt
rm bin2header.exe
- name: Package Python
run: |
pkgname="bin2header_${{ env.pyver }}_python.tar"
cd "${{ env.stage }}"
cp "${{ github.workspace }}/src/bin2header.py" "${{ env.stage }}"
tar -cf "${pkgname}" --mode=0755 bin2header.py
tar -uf "${pkgname}" LICENSE.txt
xz -z9 "${pkgname}"
rm bin2header.py
- name: Package source
run: "${{ github.workspace }}/scripts/dist_source.sh"
- name: Get changes
run: sed -e '/^$/,$d' -e '1 s/^.*$/Changes:\n/' CHANGES.txt > release_notes.tmp
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: 'Version ${{ env.ver }}'
body_path: release_notes.tmp
files: |
bin2header-${{ env.ver }}.tar.xz
build/stage/bin2header_${{ env.ver }}_*.zip
build/stage/bin2header_${{ env.pyver }}_python.tar.xz
prerelease: true