-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github: Mikusch | ||
ko_fi: Mikusch |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Compile and Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
PLUGIN_NAME: mitm | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
sm-version: ['1.12.x'] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set environment variables | ||
run: echo "SCRIPTS_PATH=$(pwd)" >> $GITHUB_ENV | ||
|
||
- name: Create include directory | ||
run: mkdir -p ${{ env.SCRIPTS_PATH }}/addons/sourcemod/scripting/include | ||
|
||
- name: Download repositories | ||
run: | | ||
declare -A repos=( | ||
["https://github.com/TF2-DMB/CBaseNPC"]="addons/sourcemod/scripting/include" | ||
["https://github.com/nosoop/SMExt-SourceScramble"]="addons/sourcemod/scripting/include" | ||
["https://github.com/FortyTwoFortyTwo/VScript"]="addons/sourcemod/scripting/include" | ||
["https://github.com/Mikusch/SM-Memory"]="pawn/sourcemod/scripting/include" | ||
["https://github.com/nosoop/SM-TFEconData"]="addons/sourcemod/scripting/include" | ||
["https://github.com/FlaminSarge/tf2attributes"]="addons/sourcemod/scripting/include" | ||
["https://github.com/nosoop/SM-TFUtils"]="addons/sourcemod/scripting/include" | ||
) | ||
for repo in "${!repos[@]}"; do | ||
repo_name=$(basename "$repo") | ||
include_path="${repos[$repo]}" | ||
echo "Cloning $repo..." | ||
git clone --depth 1 "$repo" "$repo_name" | ||
find "$repo_name" -type f -name "*.inc" | while read -r file; do | ||
relative_path="${file#*/scripting/include/}" | ||
mkdir -p "${{ env.SCRIPTS_PATH }}/addons/sourcemod/scripting/include/$(dirname "$relative_path")" | ||
mv "$file" "${{ env.SCRIPTS_PATH }}/addons/sourcemod/scripting/include/$relative_path" | ||
done | ||
rm -rf "$repo_name" | ||
done | ||
- name: Download include files | ||
run: | | ||
declare -A includes=( | ||
["https://raw.githubusercontent.com/DoctorMcKay/sourcemod-plugins/master/scripting/include/morecolors.inc"]="addons/sourcemod/scripting/include/morecolors.inc" | ||
["https://raw.githubusercontent.com/Mikusch/PluginStateManager/master/addons/sourcemod/scripting/include/pluginstatemanager.inc"]="addons/sourcemod/scripting/include/pluginstatemanager.inc" | ||
) | ||
for url in "${!includes[@]}"; do | ||
target_path="${includes[$url]}" | ||
mkdir -p "$(dirname "$target_path")" | ||
echo "Downloading $url -> $target_path" | ||
curl -sSL "$url" -o "$target_path" | ||
done | ||
- name: Setup SourcePawn Compiler ${{ matrix.sm-version }} | ||
id: setup_sp | ||
uses: rumblefrog/setup-sp@master | ||
with: | ||
version: ${{ matrix.sm-version }} | ||
version-file: ./addons/sourcemod/scripting/${{ env.PLUGIN_NAME }}.sp | ||
define-name: PLUGIN_VERSION | ||
|
||
- name: Compile plugins | ||
run: | | ||
mkdir -p ../plugins | ||
spcomp -v2 -E -i "include" -o "../plugins/${{ env.PLUGIN_NAME }}.smx" ${{ env.PLUGIN_NAME }}.sp | ||
echo "===OUT FILES===" | ||
ls ../plugins | ||
echo "===VERSION===" | ||
echo ${{ steps.setup_sp.outputs.plugin-version }} | ||
working-directory: ${{ env.SCRIPTS_PATH }}/addons/sourcemod/scripting | ||
|
||
- name: Install zip | ||
uses: montudor/action-zip@v1 | ||
|
||
- name: Zip output | ||
run: | | ||
zip -qq -y -r ${{ github.event.repository.name }}.zip configs plugins scripting extensions gamedata translations data | ||
working-directory: ${{ env.SCRIPTS_PATH }}/addons/sourcemod | ||
|
||
- name: List files in the directory | ||
run: ls -R | ||
working-directory: ${{ env.SCRIPTS_PATH }}/addons/sourcemod | ||
|
||
- name: List files in the zip | ||
run: unzip -l ${{ github.event.repository.name }}.zip | ||
working-directory: ${{ env.SCRIPTS_PATH }}/addons/sourcemod | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ steps.setup_sp.outputs.plugin-version }} | ||
artifacts: addons/sourcemod/${{ github.event.repository.name }}.zip | ||
draft: true | ||
allowUpdates: true | ||
updateOnlyUnreleased: true | ||
skipIfReleaseExists: true |