Skip to content

Commit 9f8aa4e

Browse files
committed
merge dev
2 parents 042c974 + 4532386 commit 9f8aa4e

File tree

5 files changed

+406
-9
lines changed

5 files changed

+406
-9
lines changed
+269
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
name: Build & deploy server to custom CDN branch
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
cdn_branch:
6+
description: 'CDN branch'
7+
required: true
8+
version:
9+
description: 'Version'
10+
required: true
11+
12+
jobs:
13+
build-windows:
14+
name: Build windows release
15+
runs-on: windows-2019
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
with:
20+
submodules: recursive
21+
22+
- name: Extract version
23+
id: version
24+
shell: bash
25+
run: |
26+
TAG=${GITHUB_REF/refs\/tags\//}
27+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
28+
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
29+
30+
- name: Build
31+
shell: cmd
32+
run: |
33+
cd server
34+
build.bat 0 %VERSION%
35+
env:
36+
VERSION: ${{ steps.version.outputs.VERSION }}
37+
38+
- name: Copy files
39+
shell: cmd
40+
run: |
41+
cd server
42+
mkdir upload\modules\js-module
43+
mkdir debug
44+
copy dist\js-module.dll upload\modules\js-module
45+
copy dist\libnode.dll upload\modules\js-module
46+
copy dist\js-module.pdb debug
47+
48+
- uses: actions/upload-artifact@v3
49+
with:
50+
name: js-module-windows
51+
path: ./server/upload/
52+
53+
- uses: actions/upload-artifact@v3
54+
with:
55+
name: js-module-windows-debug
56+
path: ./server/debug
57+
58+
build-linux:
59+
name: Build linux release
60+
runs-on: ubuntu-20.04
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v3
64+
with:
65+
submodules: recursive
66+
67+
- name: Extract version
68+
id: version
69+
shell: bash
70+
run: |
71+
TAG=${GITHUB_REF/refs\/tags\//}
72+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
73+
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
74+
cd shared/deps/cpp-sdk
75+
echo "SDK_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
76+
77+
- name: Build
78+
run: |
79+
cd server
80+
./build.sh %VERSION%
81+
env:
82+
VERSION: ${{ steps.version.outputs.VERSION }}
83+
84+
- name: Copy files
85+
run: |
86+
cd server
87+
mkdir -p upload/modules/js-module
88+
cp ./dist/libjs-module.so ./upload/modules/js-module
89+
cp ./dist/libnode.so ./upload/modules/js-module
90+
echo ${{ steps.version.outputs.SDK_COMMIT }} >> ./upload/sdk.version
91+
92+
- uses: actions/upload-artifact@v3
93+
with:
94+
name: js-module-linux
95+
path: ./server/upload/
96+
97+
deploy-cdn:
98+
name: Deploy release to alt:V CDN
99+
runs-on: ubuntu-20.04
100+
needs: [build-linux, build-windows]
101+
steps:
102+
- name: Set up Node.js
103+
uses: actions/setup-node@v3
104+
with:
105+
node-version: 16.x
106+
107+
- name: Cache node_modules
108+
uses: actions/cache@v3
109+
with:
110+
path: '**/node_modules'
111+
key: ${{ runner.os }}
112+
113+
- name: Download windows artifacts
114+
uses: actions/download-artifact@v3
115+
with:
116+
name: js-module-windows
117+
path: dist-windows
118+
119+
- name: Download linux artifacts
120+
uses: actions/download-artifact@v3
121+
with:
122+
name: js-module-linux
123+
path: dist-linux
124+
125+
- name: Extract version
126+
id: version
127+
shell: bash
128+
run: |
129+
TAG=${GITHUB_REF/refs\/tags\//}
130+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
131+
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
132+
echo "SDK_VERSION=$(cat dist-linux/sdk.version)" >> $GITHUB_OUTPUT
133+
rm dist-linux/sdk.version
134+
135+
- name: Install upload tool
136+
run: npm i @altmp/upload-tool@latest fast-xml-parser@4.3.6
137+
138+
- name: Deploy windows artifacts to cdn
139+
run: npx alt-upload dist-windows js-module/$BRANCH/x64_win32 $VERSION $SDK_VERSION
140+
env:
141+
AWS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
142+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
143+
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
144+
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
145+
CF_CACHE_PURGE_TOKEN: ${{ secrets.CF_CACHE_PURGE_TOKEN }}
146+
CF_CACHE_ZONE_ID: ${{ secrets.CF_CACHE_ZONE_ID }}
147+
CF_CACHE_PURGE_URL: ${{ secrets.CF_CACHE_PURGE_URL }}
148+
BRANCH: ${{ steps.version.outputs.BRANCH }}
149+
VERSION: ${{ steps.version.outputs.VERSION }}
150+
SDK_VERSION: ${{ steps.version.outputs.SDK_VERSION }}
151+
152+
- name: Deploy linux artifacts to cdn
153+
run: npx alt-upload dist-linux js-module/$BRANCH/x64_linux $VERSION $SDK_VERSION
154+
env:
155+
AWS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
156+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
157+
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
158+
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
159+
CF_CACHE_PURGE_TOKEN: ${{ secrets.CF_CACHE_PURGE_TOKEN }}
160+
CF_CACHE_ZONE_ID: ${{ secrets.CF_CACHE_ZONE_ID }}
161+
CF_CACHE_PURGE_URL: ${{ secrets.CF_CACHE_PURGE_URL }}
162+
BRANCH: ${{ steps.version.outputs.BRANCH }}
163+
VERSION: ${{ steps.version.outputs.VERSION }}
164+
SDK_VERSION: ${{ steps.version.outputs.SDK_VERSION }}
165+
166+
build-docker:
167+
name: Trigger Docker image build
168+
runs-on: ubuntu-latest
169+
needs: [deploy-cdn]
170+
steps:
171+
- name: Get Token
172+
id: get_workflow_token
173+
uses: peter-murray/workflow-application-token-action@v2
174+
with:
175+
application_id: ${{ secrets.CI_APP_ID }}
176+
application_private_key: ${{ secrets.CI_APP_PRIVATE_KEY }}
177+
permissions: "actions:write"
178+
organization: altmp
179+
180+
- name: Trigger Docker build
181+
uses: benc-uk/workflow-dispatch@v1
182+
with:
183+
workflow: build.yml
184+
ref: main
185+
repo: altmp/altv-docker
186+
token: ${{ steps.get_workflow_token.outputs.token }}
187+
188+
create-release:
189+
name: Create GitHub Release
190+
runs-on: ubuntu-20.04
191+
needs: [build-linux, build-windows]
192+
steps:
193+
- name: Download windows artifacts
194+
uses: actions/download-artifact@v3
195+
with:
196+
name: js-module-windows
197+
path: dist-windows
198+
199+
- name: Download windows debug artifacts
200+
uses: actions/download-artifact@v3
201+
with:
202+
name: js-module-windows-debug
203+
path: dist-windows
204+
205+
- name: Download linux artifacts
206+
uses: actions/download-artifact@v3
207+
with:
208+
name: js-module-linux
209+
path: dist-linux
210+
211+
- name: Extract version
212+
id: version
213+
shell: bash
214+
run: |
215+
TAG=${GITHUB_REF/refs\/tags\//}
216+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
217+
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
218+
echo "SDK_COMMIT=$(cat dist-linux/sdk.version)" >> $GITHUB_OUTPUT
219+
rm dist-linux/sdk.version
220+
221+
- name: Zip artifacts
222+
run: |
223+
zip -r -j js-module-windows dist-windows
224+
zip -r -j js-module-linux dist-linux
225+
226+
- name: Create Release
227+
id: create_release
228+
uses: actions/create-release@v1
229+
env:
230+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231+
with:
232+
tag_name: ${{ github.ref }}
233+
release_name: Release ${{ steps.version.outputs.VERSION }}
234+
body: |
235+
SDK version: [${{ steps.version.outputs.SDK_COMMIT }}](https://github.com/altmp/cpp-sdk/commit/${{ steps.version.outputs.SDK_COMMIT }})
236+
237+
- name: Upload windows artifacts
238+
uses: actions/upload-release-asset@v1
239+
env:
240+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
241+
with:
242+
upload_url: ${{ steps.create_release.outputs.upload_url }}
243+
asset_path: ./js-module-windows.zip
244+
asset_name: js-module-windows.zip
245+
asset_content_type: application/zip
246+
247+
- name: Upload linux artifacts
248+
uses: actions/upload-release-asset@v1
249+
env:
250+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251+
with:
252+
upload_url: ${{ steps.create_release.outputs.upload_url }}
253+
asset_path: ./js-module-linux.zip
254+
asset_name: js-module-linux.zip
255+
asset_content_type: application/zip
256+
257+
delete-artifacts:
258+
name: Delete artifacts
259+
runs-on: ubuntu-20.04
260+
needs: [ create-release, deploy-cdn ]
261+
if: ${{ always() }}
262+
steps:
263+
- name: Delete artifacts
264+
uses: geekyeggo/delete-artifact@v2
265+
with:
266+
name: |
267+
js-module-linux
268+
js-module-windows
269+
js-module-windows-debug

.github/workflows/build-deploy.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ jobs:
4444
copy dist\libnode.dll upload\modules\js-module
4545
copy dist\js-module.pdb debug
4646
47-
- uses: actions/upload-artifact@v3
47+
- uses: actions/upload-artifact@v4
4848
with:
4949
name: js-module-windows
5050
path: ./server/upload/
5151

52-
- uses: actions/upload-artifact@v3
52+
- uses: actions/upload-artifact@v4
5353
with:
5454
name: js-module-windows-debug
5555
path: ./server/debug
@@ -88,7 +88,7 @@ jobs:
8888
cp ./dist/libnode.so ./upload/modules/js-module
8989
echo ${{ steps.version.outputs.SDK_COMMIT }} >> ./upload/sdk.version
9090
91-
- uses: actions/upload-artifact@v3
91+
- uses: actions/upload-artifact@v4
9292
with:
9393
name: js-module-linux
9494
path: ./server/upload/
@@ -110,13 +110,13 @@ jobs:
110110
key: ${{ runner.os }}
111111

112112
- name: Download windows artifacts
113-
uses: actions/download-artifact@v3
113+
uses: actions/download-artifact@v4
114114
with:
115115
name: js-module-windows
116116
path: dist-windows
117117

118118
- name: Download linux artifacts
119-
uses: actions/download-artifact@v3
119+
uses: actions/download-artifact@v4
120120
with:
121121
name: js-module-linux
122122
path: dist-linux
@@ -190,19 +190,19 @@ jobs:
190190
needs: [build-linux, build-windows]
191191
steps:
192192
- name: Download windows artifacts
193-
uses: actions/download-artifact@v3
193+
uses: actions/download-artifact@v4
194194
with:
195195
name: js-module-windows
196196
path: dist-windows
197197

198198
- name: Download windows debug artifacts
199-
uses: actions/download-artifact@v3
199+
uses: actions/download-artifact@v4
200200
with:
201201
name: js-module-windows-debug
202202
path: dist-windows
203203

204204
- name: Download linux artifacts
205-
uses: actions/download-artifact@v3
205+
uses: actions/download-artifact@v4
206206
with:
207207
name: js-module-linux
208208
path: dist-linux

server/src/bindings/Player.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,7 @@ extern V8Class v8Player("Player",
16151615
V8Helpers::SetMethod(isolate, tpl, "removeDecoration", &RemoveDecoration);
16161616
V8Helpers::SetMethod(isolate, tpl, "clearDecorations", &ClearDecorations);
16171617
V8Helpers::SetMethod(isolate, tpl, "getDecorations", &GetDecorations);
1618+
V8Helpers::SetAccessor<IPlayer, bool, &IPlayer::IsOnVehicle>(isolate, tpl, "isOnVehicle");
16181619

16191620
V8Helpers::SetAccessor<IPlayer, bool, &IPlayer::IsNetworkOwnershipDisabled, &IPlayer::SetNetworkOwnershipDisabled>(isolate, tpl, "netOwnershipDisabled");
16201621
});

0 commit comments

Comments
 (0)