-
Notifications
You must be signed in to change notification settings - Fork 3
222 lines (188 loc) · 7.18 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Publish new release
on: workflow_dispatch
jobs:
build-windows-x64:
name: Build Windows x64
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install deps
shell: bash
run: |
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
- name: Build protobuf
shell: bash
run: |
cd protobuf/cmake && mkdir build
cmake -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=.\build .
cmake --build . --config Release
cd ../..
echo "${{ github.workspace }}/protobuf/cmake/Release" >> $GITHUB_PATH
- name: Build boiler-writter
shell: bash
run: |
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
mkdir tmp && cp -r bin tmp && rm -rf bin && mv tmp bin
- uses: actions/upload-artifact@v4
with:
name: windows-x64
path: bin
build-macos-arm64:
name: Build macOS ARM64
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install deps
run: |
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
brew install automake autoconf libtool
- name: Build protobuf
run: |
cd protobuf
./autogen.sh
./configure CXXFLAGS="-DNDEBUG"
make -j$(sysctl -n hw.physicalcpu)
sudo make install
cd ..
- name: Build boiler-writter
run: |
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
mkdir tmp && cp -r bin tmp && rm -rf bin && mv tmp bin
- uses: actions/upload-artifact@v4
with:
name: macos-arm64
path: bin
build-macos-x64:
name: Build macOS x64
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install deps
run: |
/usr/bin/arch -x86_64 /bin/zsh --login <<'EOF'
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install automake autoconf libtool
EOF
- name: Build protobuf
run: |
/usr/bin/arch -x86_64 /bin/zsh --login <<'EOF'
cd protobuf
./autogen.sh
./configure CXXFLAGS="-DNDEBUG"
make -j$(sysctl -n hw.physicalcpu)
sudo make install
cd ..
EOF
- name: Build boiler-writter
run: |
/usr/bin/arch -x86_64 /bin/zsh --login <<'EOF'
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
mkdir tmp && cp -r bin tmp && rm -rf bin && mv tmp bin
EOF
- uses: actions/upload-artifact@v4
with:
name: macos-x64
path: bin
build-linux-x64:
name: Build Linux x64
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install deps
run: |
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
sudo apt-get install build-essential autoconf gcc gcc-multilib g++-multilib libtool -y
- name: Build protobuf
run: |
cd protobuf
./autogen.sh
./configure CXXFLAGS="-DNDEBUG"
make -j$(nproc)
sudo make install
sudo ldconfig
cd ..
- name: Build boiler-writter
run: |
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
mkdir tmp && cp -r bin tmp && rm -rf bin && mv tmp bin
- uses: actions/upload-artifact@v4
with:
name: linux-x64
path: bin
publish-release:
name: Publish release
runs-on: ubuntu-latest
needs:
[build-windows-x64, build-macos-arm64, build-macos-x64, build-linux-x64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create new version
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
npm version minor -m "chore: v%s"
echo "VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV"
- name: Build archives
run: |
cd windows-x64 && zip -r ../"boiler-writter-win-$VERSION.zip" bin && cd -
chmod +x macos-x64/bin/boiler-writter
cd macos-x64 && zip -r ../"boiler-writter-mac-$VERSION.zip" bin && cd -
chmod +x macos-arm64/bin/boiler-writter
cd macos-arm64 && zip -r ../"boiler-writter-mac-arm64-$VERSION.zip" bin && cd -
chmod +x linux-x64/bin/boiler-writter
cd linux-x64 && zip -r ../"boiler-writter-linux-$VERSION.zip" bin && cd -
- name: Publish NPM
run: |
mkdir -p dist/bin/{darwin-arm64,darwin-x64,linux-x64,win32-x64}
cp windows-x64/bin/* dist/bin/win32-x64
cp macos-x64/bin/* dist/bin/darwin-x64
cp macos-arm64/bin/* dist/bin/darwin-arm64
cp linux-x64/bin/* dist/bin/linux-x64
zip -r "dist-npm.zip" dist
npm publish --access public --registry https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
- name: GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ env.VERSION }}
allowUpdates: true
draft: true
replacesArtifacts: true
artifacts: "boiler-writter-*.zip,dist-npm.zip"
- name: Push the tag to GitHub
run: git push origin main --tags