Skip to content

Commit

Permalink
Each variable is now configurable via modSettings.json.
Browse files Browse the repository at this point in the history
Thanks to DeCell for much of the code and the idea.
Also converted project format from gradle to intellij.
  • Loading branch information
wispborne committed Dec 23, 2023
1 parent 5c03569 commit 46d6b74
Show file tree
Hide file tree
Showing 35 changed files with 176 additions and 780 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ Every time you make+push a new git tag, it'll create a GitHub release for you.

## Steps

1. Extract zip into your mod directory (which must be hosted on GitHub).
2. Open `~/.github/workflows/runner.sh` and change `MOD_FOLDER_NAME=My-Mod` to your mod folder name.
3. Commit and push these changes, then create and push a new tag.
1. Commit and push some changes, then create and push a new tag.

Optionally, you may edit "blacklist.txt", which contains regex expressions of files that will NOT be included in the released mod folder (eg psd files)

```text
1.1
- Release message is now your tagged commit's message
1.0
- Initial commit
```
6 changes: 5 additions & 1 deletion .github/workflows/blacklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ DO_NOT_USE
^.github/
banner.png$
starfarer/
^.run/
^.run/
media/
^release_checklist.md$
docs/
dokka/
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ jobs:
# Checks-out repository under $GITHUB_WORKSPACE, so your job can access it
# GitHub Actions by default doesn't check out tags, so make sure those are included
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Fetch Tags
run: git fetch --prune --unshallow --tags


# Tags with unstable, dev, qa in them will be marked as prerelease.
- name: Set Variables
run: |
echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV
git log --format=%B -n 1 $(git log -1 --pretty=format:"%h") | cat - > changes.txt
if [[ "$(git describe --tags)" =~ .*"dev"|"qa"|"unstable".* ]]; then
echo "IS_PRERELEASE=true" >> $GITHUB_ENV;
else
echo "IS_PRERELEASE=false" >> $GITHUB_ENV;
fi
- name: Create Mod Zipfile
run: |
Expand All @@ -36,12 +42,12 @@ jobs:
./runner.sh
- name: Publish Release on GitHub
uses: "ncipollo/release-action@v1"
uses: "ncipollo/release-action@v1.12.0"
with:
name: ${{ env.VERSION }}
tag: ${{ env.VERSION }}
bodyFile: changes.txt
draft: false
prerelease: false
prerelease: '${{ env.IS_PRERELEASE }}'
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ".github/workflows/artifacts/*"
5 changes: 3 additions & 2 deletions .github/workflows/runner.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/sh

### Edit
# Your mod name. The version number will be attached to this to form "My-Mod-1.0.0"
MOD_FOLDER_NAME=Neutrino-Detector-MkII
# Your mod name. The version number will be attached to this to form "My-Mod"
MOD_FOLDER_NAME="Neutrino-Detector-MkII"
echo "Folder name will be $MOD_FOLDER_NAME"
###


Expand Down
34 changes: 15 additions & 19 deletions .github/workflows/zipMod.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/sh

# USAGE
# Run from within the
# Run from within the
# ./zipMod.sh "folderToZip" "outputFolderName"
# arg folderToZip: The folder containing mod_info.json.
# ex: "D:/Code/Persean-Chronicles"
# arg outputFolderName: Do not append the version, it will be appended.
# ex: "Persean-Chronicles"
# arg outputFolderName

folderToZip=$1
outputFolderName=$2
Expand All @@ -16,30 +14,28 @@ echo "Executing dir: $startingDir"
echo "Location of folder to zip:" $(realpath $1)

cd $folderToZip
version=$(git describe --tags)
zipName=$outputFolderName-$version.zip
zipName=$outputFolderName.zip

echo "Version: $version"

# Recreate the temp folder if it happens to be present
rm -rf "./$outputFolderName-$version"
mkdir "$outputFolderName-$version"
# Recreate the temp folder if it happens to be present.
rm -rf "./$outputFolderName"
mkdir "$outputFolderName"

# 1. List all files in git, which uses gitignore
# 2. Remove any file matching the blacklist (eg afphoto files)
# 3. Copy to a new folder with the mod name and version
# 1. List all files in git, which uses gitignore.
# 2. Remove any file matching the blacklist (eg afphoto files).
# 3. Copy to a new folder with the mod name.
echo "Reading blacklist...\n$(cat $startingDir/blacklist.txt)"
git ls-files | grep -Evf $startingDir/blacklist.txt | while read file; do cp --parents "$file" "$outputFolderName-$version"; done
git ls-files | grep -Evf $startingDir/blacklist.txt | while read file; do cp --parents "$file" "$outputFolderName"; done

# Zip the folder, then clean it up
zip -r $zipName "./$outputFolderName-$version"
# Zip the folder, then clean it up.
zip -r $zipName "./$outputFolderName"
echo "Created zip file at $(realpath $zipName)"
rm -rf "./$outputFolderName-$version"
rm -rf "./$outputFolderName"

# Move the zip to the artifacts folder in the executing directory
# Move the zip to the artifacts folder in the executing directory.
mkdir -p $startingDir/artifacts
mv ./$zipName $startingDir/artifacts/
echo "Moved zip file to $(realpath $startingDir/artifacts/$zipName)"

# Return to the executing directory
# Return to the executing directory.
cd $startingDir
4 changes: 4 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/Create__jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/csv-editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/modules/neutrino_detector_mkii.iml

This file was deleted.

106 changes: 0 additions & 106 deletions .idea/modules/neutrino_detector_mkii.main.iml

This file was deleted.

0 comments on commit 46d6b74

Please sign in to comment.