Fix plugins list #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
types: [opened, reopened, synchronize] | |
release: | |
types: [published] | |
env: | |
PACKAGE_NAME: VipModular | |
STORE_README: 0 | |
GENERATE_PLUGINS_INI: 1 | |
PLUGINS_INI_POSTFIX: vipm | |
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 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 }} | |
GENERATE_PLUGINS_INI: ${{ env.GENERATE_PLUGINS_INI }} | |
PLUGINS_INI_POSTFIX: ${{ env.PLUGINS_INI_POSTFIX }} | |
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" | |
if [ ! -z "${GENERATE_PLUGINS_INI}" ]; then | |
plugin_ini_path="../configs/plugins-${PLUGINS_INI_POSTFIX}.ini" | |
touch $plugin_ini_path | |
echo $amxxfile >> $plugin_ini_path | |
fi | |
} | |
export -f compile | |
find . -type f -name "*.sma" -exec bash -c 'compile "$0"' {} \; | |
- name: Move files | |
env: | |
STORE_README: ${{ env.STORE_README }} | |
run: | | |
mkdir -p publish/${{ env.PACKAGE_NAME }}/addons | |
mv amxmodx/ publish/${{ env.PACKAGE_NAME }}/addons | |
if [ ! -z "${STORE_README}" ]; 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 |