Skip to content

Add CWeapon_OnPlayerThrowGrenade event #29

Add CWeapon_OnPlayerThrowGrenade event

Add CWeapon_OnPlayerThrowGrenade event #29

Workflow file for this run

name: CI
on:
push:
branches: [master]
paths-ignore:
- "**.md"
pull_request:
types: [opened, reopened, synchronize]
release:
types: [published]
env:
PACKAGE_NAME: CustomWeaponsAPI
STORE_READMY: 1
PARAMS_CONRTOLLER_TAG: 1.0.0-b4
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
outputs:
COMMIT_SHA: ${{ steps.declare_sha.outputs.COMMIT_SHA }}
SEMVER: ${{ steps.declare_sha.outputs.SEMVER }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Parse SemVer string (release)
id: semver_parser
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
uses: booxmedialtd/[email protected]
with:
input_string: ${{ github.ref }}
version_extractor_regex: 'refs\/tags\/(.*)$'
- name: Declare SHA & package name
id: declare_sha
shell: bash
run: |
SHA=$(git rev-parse --short HEAD)
echo "COMMIT_SHA=$SHA" >> $GITHUB_OUTPUT
echo "SEMVER=${{ steps.semver_parser.outputs.fullversion }}" >> $GITHUB_OUTPUT
- name: Setup latest ReAPI includes
env:
REPO: "rehlds/reapi"
run: |
mkdir -p dep/reapi
cd dep/reapi
curl \
--silent \
https://api.github.com/repos/$REPO/releases/latest | \
jq .assets[0].browser_download_url -r | \
xargs wget
7z x *.zip
echo "REAPI_INCLUDE_PATH=$(pwd)/addons/amxmodx/scripting/include" >> $GITHUB_ENV
- name: Setup ParamsController includes
env:
REPO: AmxxModularEcosystem/ParamsController
TAG: ${{ env.PARAMS_CONRTOLLER_TAG }}
OUTPUT_VAR_NAME: PARAMS_CONRTOLLER_INCLUDE_PATH
run: |
mkdir -p dep/${REPO}
cd dep/${REPO}
if [ -z "${TAG}" ]; then
TAG=`curl --silent https://api.github.com/repos/${REPO}/releases/latest | jq .tag_name -r`
fi
wget https://github.com/${REPO}/archive/refs/tags/${TAG}.zip
7z x ${TAG}.zip
REPO_NAME=`echo "${REPO}" | grep -Po '(?<=\/).+'`
echo "${OUTPUT_VAR_NAME}=$(pwd)/${REPO_NAME}-${TAG}/${INCLUDE_PATH:-amxmodx/scripting/include}" >> $GITHUB_ENV
- name: Setup AMXXPawn Compiler
uses: wopox1337/[email protected]
with:
version: "1.10.5428"
- name: Compile plugins
working-directory: amxmodx/scripting/
env:
REAPI_INCLUDE: ${{ env.REAPI_INCLUDE_PATH }}
PARAMS_CONRTOLLER_INCLUDE: ${{ env.PARAMS_CONRTOLLER_INCLUDE_PATH }}
run: |
compile() {
sourcefile=$1
amxxfile="$(echo $sourcefile | sed -e 's/\.sma$/.amxx/')"
output_path="../plugins/$amxxfile"
mkdir -p $(dirname $output_path)
echo -n "Compiling $sourcefile ... "
amxxpc $sourcefile -o"$output_path" \
-i"include" \
-i"$REAPI_INCLUDE" \
-i"$PARAMS_CONRTOLLER_INCLUDE"
}
export -f compile
find . -type f -name "*.sma" -exec bash -c 'compile "$0"' {} \;
- name: Move files
env:
STORE_READMY: ${{ env.STORE_READMY }}
run: |
mkdir -p publish/${{ env.PACKAGE_NAME }}/addons
mv amxmodx/ publish/${{ env.PACKAGE_NAME }}/addons
if [ ! -z "${STORE_READMY}" ]; then
mv README.md publish/
fi
- name: Deploy artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }}-${{ steps.declare_sha.outputs.COMMIT_SHA }}-dev
path: publish/*
publish:
name: "Publish release"
runs-on: ubuntu-latest
needs: [build]
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }}-${{ needs.build.outputs.COMMIT_SHA }}-dev
- name: Packaging binaries
id: packaging
run: 7z a -mm=Deflate -mfb=258 -mpass=15 -r ${{ env.PACKAGE_NAME }}-${{ needs.build.outputs.SEMVER }}.zip
- name: Publish artifacts
uses: softprops/[email protected]
id: publish-job
if: |
startsWith(github.ref, 'refs/tags/') &&
steps.packaging.outcome == 'success'
with:
files: |
*.zip