From f6fd37540604377ae2443de57295bcee2dbeb84e Mon Sep 17 00:00:00 2001 From: maxime1907 <19607336+maxime1907@users.noreply.github.com> Date: Sat, 5 Nov 2022 12:54:52 +0100 Subject: [PATCH] feat: github ci --- .github/workflows/ci.yml | 89 +++++++++++++++++++++++++++ .gitignore | 10 +++ configs/stripper/global_filters.cfg | 86 ++++++++++++++++++++++++++ configs/stripper/maps/example_map.cfg | 35 +++++++++++ sourceknight.yaml | 17 +++++ 5 files changed, 237 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 configs/stripper/global_filters.cfg create mode 100644 configs/stripper/maps/example_map.cfg create mode 100644 sourceknight.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6eb3272 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,89 @@ +name: CI + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + name: "Build" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + include: + - os: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - name: Build sourcemod plugin + uses: maxime1907/action-sourceknight@v1 + with: + cmd: build + + - name: Create package + run: | + mkdir -p /tmp/package + cp -R .sourceknight/package/* /tmp/package + cp -R configs /tmp/package/common/addons/sourcemod/ + + - name: Upload build archive for test runners + uses: actions/upload-artifact@v3 + with: + name: ${{ runner.os }} + path: /tmp/package + + tag: + name: Tag + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + + - uses: dev-drprasad/delete-tag-and-release@v0.2.1 + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + with: + delete_release: true + tag_name: latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: rickstaa/action-create-tag@v1 + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + with: + tag: "latest" + github_token: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Release + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + needs: [build, tag] + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: Versioning + run: | + version="latest" + if [[ "${{ github.ref_type }}" == 'tag' ]]; then + version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`; + fi + echo "RELEASE_VERSION=$version" >> $GITHUB_ENV + + - name: Package + run: | + ls -Rall + if [ -d "./Linux/" ]; then + cd ./Linux/ + tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz -T <(\ls -1) + cd - + fi + + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: '*.tar.gz' + tag: ${{ env.RELEASE_VERSION }} + file_glob: true + overwrite: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40f37f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +build/ +release/ + +.DS_Store +.vscode + +*.smx +plugins/ +.sourceknight +.venv diff --git a/configs/stripper/global_filters.cfg b/configs/stripper/global_filters.cfg new file mode 100644 index 0000000..34d7009 --- /dev/null +++ b/configs/stripper/global_filters.cfg @@ -0,0 +1,86 @@ +;; Changes ammo to 8000 on every map-spawned weapon +;modify: +;{ +; match: +; { +; "classname" "/weapon_.*/" +; } +; replace: +; { +; "ammo" "8000" +; } +;} + +;; Remove game_end +;filter: +;{ +; "classname" "game_end" +;} + +;;Cool Music Entities +;add: +;{ +; "origin" "0 0 0" +; "targetname" "GlobalAmbientGenericStripper" +; "spawnflags" "49" +; "radius" "1250" +; "pitchstart" "100" +; "pitch" "100" +; "message" "music/hl1_song10.mp3" +; "health" "10" +; "classname" "ambient_generic" +;} + +;add: +;{ +; "origin" "0 0 0" +; "targetname" "GlobalAmbientGenericStripper2" +; "spawnflags" "49" +; "radius" "1250" +; "pitchstart" "100" +; "pitch" "100" +; "message" "music/hl2_song23_suitsong3.mp3" +; "health" "10" +; "classname" "ambient_generic" +;} + +;add: +;{ +; "origin" "0 0 0" +; "targetname" "GlobalAmbientGenericStripper2" +; "spawnflags" "49" +; "radius" "1250" +; "pitchstart" "100" +; "pitch" "100" +; "message" "music/hl2_song23_suitsong3.mp3" +; "health" "10" +; "classname" "ambient_generic" +;} + +;add: +;{ +; "origin" "0 0 0" +; "targetname" "GlobalLogicTimerStripper" +; "RefireTime" "0.1" +; "spawnflags" "0" +; "StartDisabled" "1" +; "UseRandomTime" "0" +; "classname" "logic_timer" +;} + +;add: +;{ +; "origin" "0 0 0" +; "targetname" "GlobalGameTextStripper" +; "x" "-1" +; "y" ".20" +; "channel" "4" +; "message" "Default Message" +; "color" "0 255 255" +; "color2" "0 240 240" +; "fadein" ".1" +; "fadeout" ".1" +; "holdtime" "3" +; "spawnflags" "1" +; "classname" "game_text" +;} diff --git a/configs/stripper/maps/example_map.cfg b/configs/stripper/maps/example_map.cfg new file mode 100644 index 0000000..8ba91fd --- /dev/null +++ b/configs/stripper/maps/example_map.cfg @@ -0,0 +1,35 @@ +;;EXAMPLE - remove all physics props +;remove: +;{ +; "classname" "/prop_physics.*/" +;} + +;;EXAMPLE - add the hostage to the map +;add: +;{ +; "origin" "1376 3168 -112" +; "HostageType" "0" +; "classname" "hostage_entity" +} + +;;EXAMPLE - replace all garbage cans with a hostage +;modify: +;{ +; match: +; { +; "model" "models/props_junk/garbage_metalcan002a.mdl" +; "classname" "prop_physics_multiplayer" +; } +; replace: +; { +; "classname" "hostage_entity" +; } +; delete: +; { +; "model" "models/props_junk/garbage_metalcan002a.mdl" +; } +; insert: +; { +; "scale" "0.99" +; } +;} diff --git a/sourceknight.yaml b/sourceknight.yaml new file mode 100644 index 0000000..8b47629 --- /dev/null +++ b/sourceknight.yaml @@ -0,0 +1,17 @@ +project: + sourceknight: 0.1 + name: stripper + dependencies: + - name: sourcemod + type: tar + version: 1.12.0-git6935 + location: https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git6935-linux.tar.gz + unpack: + - source: /addons + dest: /addons + + root: / + workdir: / + output: /plugins + targets: + - stripper