Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Feb 7, 2025
2 parents 042c974 + 4532386 commit 9f8aa4e
Show file tree
Hide file tree
Showing 5 changed files with 406 additions and 9 deletions.
269 changes: 269 additions & 0 deletions .github/workflows/build-deploy-custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
name: Build & deploy server to custom CDN branch
on:
workflow_dispatch:
inputs:
cdn_branch:
description: 'CDN branch'
required: true
version:
description: 'Version'
required: true

jobs:
build-windows:
name: Build windows release
runs-on: windows-2019
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Extract version
id: version
shell: bash
run: |
TAG=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
- name: Build
shell: cmd
run: |
cd server
build.bat 0 %VERSION%
env:
VERSION: ${{ steps.version.outputs.VERSION }}

- name: Copy files
shell: cmd
run: |
cd server
mkdir upload\modules\js-module
mkdir debug
copy dist\js-module.dll upload\modules\js-module
copy dist\libnode.dll upload\modules\js-module
copy dist\js-module.pdb debug
- uses: actions/upload-artifact@v3
with:
name: js-module-windows
path: ./server/upload/

- uses: actions/upload-artifact@v3
with:
name: js-module-windows-debug
path: ./server/debug

build-linux:
name: Build linux release
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Extract version
id: version
shell: bash
run: |
TAG=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
cd shared/deps/cpp-sdk
echo "SDK_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build
run: |
cd server
./build.sh %VERSION%
env:
VERSION: ${{ steps.version.outputs.VERSION }}

- name: Copy files
run: |
cd server
mkdir -p upload/modules/js-module
cp ./dist/libjs-module.so ./upload/modules/js-module
cp ./dist/libnode.so ./upload/modules/js-module
echo ${{ steps.version.outputs.SDK_COMMIT }} >> ./upload/sdk.version
- uses: actions/upload-artifact@v3
with:
name: js-module-linux
path: ./server/upload/

deploy-cdn:
name: Deploy release to alt:V CDN
runs-on: ubuntu-20.04
needs: [build-linux, build-windows]
steps:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Cache node_modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}

- name: Download windows artifacts
uses: actions/download-artifact@v3
with:
name: js-module-windows
path: dist-windows

- name: Download linux artifacts
uses: actions/download-artifact@v3
with:
name: js-module-linux
path: dist-linux

- name: Extract version
id: version
shell: bash
run: |
TAG=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
echo "SDK_VERSION=$(cat dist-linux/sdk.version)" >> $GITHUB_OUTPUT
rm dist-linux/sdk.version
- name: Install upload tool
run: npm i @altmp/upload-tool@latest [email protected]

- name: Deploy windows artifacts to cdn
run: npx alt-upload dist-windows js-module/$BRANCH/x64_win32 $VERSION $SDK_VERSION
env:
AWS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
CF_CACHE_PURGE_TOKEN: ${{ secrets.CF_CACHE_PURGE_TOKEN }}
CF_CACHE_ZONE_ID: ${{ secrets.CF_CACHE_ZONE_ID }}
CF_CACHE_PURGE_URL: ${{ secrets.CF_CACHE_PURGE_URL }}
BRANCH: ${{ steps.version.outputs.BRANCH }}
VERSION: ${{ steps.version.outputs.VERSION }}
SDK_VERSION: ${{ steps.version.outputs.SDK_VERSION }}

- name: Deploy linux artifacts to cdn
run: npx alt-upload dist-linux js-module/$BRANCH/x64_linux $VERSION $SDK_VERSION
env:
AWS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
CF_CACHE_PURGE_TOKEN: ${{ secrets.CF_CACHE_PURGE_TOKEN }}
CF_CACHE_ZONE_ID: ${{ secrets.CF_CACHE_ZONE_ID }}
CF_CACHE_PURGE_URL: ${{ secrets.CF_CACHE_PURGE_URL }}
BRANCH: ${{ steps.version.outputs.BRANCH }}
VERSION: ${{ steps.version.outputs.VERSION }}
SDK_VERSION: ${{ steps.version.outputs.SDK_VERSION }}

build-docker:
name: Trigger Docker image build
runs-on: ubuntu-latest
needs: [deploy-cdn]
steps:
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.CI_APP_ID }}
application_private_key: ${{ secrets.CI_APP_PRIVATE_KEY }}
permissions: "actions:write"
organization: altmp

- name: Trigger Docker build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build.yml
ref: main
repo: altmp/altv-docker
token: ${{ steps.get_workflow_token.outputs.token }}

create-release:
name: Create GitHub Release
runs-on: ubuntu-20.04
needs: [build-linux, build-windows]
steps:
- name: Download windows artifacts
uses: actions/download-artifact@v3
with:
name: js-module-windows
path: dist-windows

- name: Download windows debug artifacts
uses: actions/download-artifact@v3
with:
name: js-module-windows-debug
path: dist-windows

- name: Download linux artifacts
uses: actions/download-artifact@v3
with:
name: js-module-linux
path: dist-linux

- name: Extract version
id: version
shell: bash
run: |
TAG=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "BRANCH=${{ github.event.inputs.cdn_branch }}" >> $GITHUB_OUTPUT
echo "SDK_COMMIT=$(cat dist-linux/sdk.version)" >> $GITHUB_OUTPUT
rm dist-linux/sdk.version
- name: Zip artifacts
run: |
zip -r -j js-module-windows dist-windows
zip -r -j js-module-linux dist-linux
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.version.outputs.VERSION }}
body: |
SDK version: [${{ steps.version.outputs.SDK_COMMIT }}](https://github.com/altmp/cpp-sdk/commit/${{ steps.version.outputs.SDK_COMMIT }})
- name: Upload windows artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./js-module-windows.zip
asset_name: js-module-windows.zip
asset_content_type: application/zip

- name: Upload linux artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./js-module-linux.zip
asset_name: js-module-linux.zip
asset_content_type: application/zip

delete-artifacts:
name: Delete artifacts
runs-on: ubuntu-20.04
needs: [ create-release, deploy-cdn ]
if: ${{ always() }}
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
js-module-linux
js-module-windows
js-module-windows-debug
16 changes: 8 additions & 8 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:
copy dist\libnode.dll upload\modules\js-module
copy dist\js-module.pdb debug
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: js-module-windows
path: ./server/upload/

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: js-module-windows-debug
path: ./server/debug
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
cp ./dist/libnode.so ./upload/modules/js-module
echo ${{ steps.version.outputs.SDK_COMMIT }} >> ./upload/sdk.version
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: js-module-linux
path: ./server/upload/
Expand All @@ -110,13 +110,13 @@ jobs:
key: ${{ runner.os }}

- name: Download windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: js-module-windows
path: dist-windows

- name: Download linux artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: js-module-linux
path: dist-linux
Expand Down Expand Up @@ -190,19 +190,19 @@ jobs:
needs: [build-linux, build-windows]
steps:
- name: Download windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: js-module-windows
path: dist-windows

- name: Download windows debug artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: js-module-windows-debug
path: dist-windows

- name: Download linux artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: js-module-linux
path: dist-linux
Expand Down
1 change: 1 addition & 0 deletions server/src/bindings/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,7 @@ extern V8Class v8Player("Player",
V8Helpers::SetMethod(isolate, tpl, "removeDecoration", &RemoveDecoration);
V8Helpers::SetMethod(isolate, tpl, "clearDecorations", &ClearDecorations);
V8Helpers::SetMethod(isolate, tpl, "getDecorations", &GetDecorations);
V8Helpers::SetAccessor<IPlayer, bool, &IPlayer::IsOnVehicle>(isolate, tpl, "isOnVehicle");

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

0 comments on commit 9f8aa4e

Please sign in to comment.