Skip to content

Merge branch 'rc' into release #256

Merge branch 'rc' into release

Merge branch 'rc' into release #256

Workflow file for this run

name: Build & deploy
on:
push:
branches-ignore:
- '**'
tags:
- 'dev/*.*-dev*'
- 'rc/*.*-rc*'
- 'release/*.*'
jobs:
build-windows:
name: Build windows
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
shell: cmd
run: build.bat
- name: Upload module dll
uses: actions/upload-artifact@v3
with:
name: bytecode-module-windows-dll
path: ./BUILD/bin/module/js-bytecode-module.dll
- name: Upload module pdb
uses: actions/upload-artifact@v3
with:
name: bytecode-module-windows-pdb
path: ./BUILD/bin/module/js-bytecode-module.pdb
build-linux:
name: Build linux
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
run: |
./build.sh
- name: Upload module so
uses: actions/upload-artifact@v3
with:
name: bytecode-module-linux-so
path: ./BUILD/module/libjs-bytecode-module.so
deploy:
name: Deploy
runs-on: ubuntu-22.04
needs: [build-linux, build-windows]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download windows module dll
uses: actions/download-artifact@v3
with:
name: bytecode-module-windows-dll
path: dist-windows/modules
- name: Download windows module pdb
uses: actions/download-artifact@v3
with:
name: bytecode-module-windows-pdb
path: dist
- name: Download linux module so
uses: actions/download-artifact@v3
with:
name: bytecode-module-linux-so
path: dist-linux/modules
- name: Extract version
id: version
shell: bash
run: |
TAG=${GITHUB_REF/refs\/tags\//}
echo "BRANCH=${TAG/\/*}" >> $GITHUB_OUTPUT
echo "VERSION=${TAG/*\/}" >> $GITHUB_OUTPUT
cd ./deps/cpp-sdk
echo "SDK_VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- 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 }}
- name: Upload windows module dll
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist-windows/modules/js-bytecode-module.dll
asset_name: js-bytecode-module.dll
asset_content_type: application/octet-stream
- name: Upload windows module pdb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/js-bytecode-module.pdb
asset_name: js-bytecode-module.pdb
asset_content_type: application/octet-stream
- name: Upload linux module so
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist-linux/modules/libjs-bytecode-module.so
asset_name: libjs-bytecode-module.so
asset_content_type: application/octet-stream
- name: Install CDN upload tool
run: npm i @altmp/upload-tool@latest [email protected]
- name: Upload windows files to CDN
run: npx alt-upload dist-windows js-bytecode-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: Upload linux files to CDN
run: npx alt-upload dist-linux js-bytecode-module/$BRANCH/x64_linux $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 }}
build-docker:
name: Trigger Docker image build
runs-on: ubuntu-latest
needs: [deploy]
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 }}
delete-artifacts:
name: Delete artifacts
runs-on: ubuntu-20.04
needs: [deploy]
if: ${{ always() }}
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
bytecode-module-windows-dll
bytecode-module-windows-pdb
bytecode-module-linux-so