-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feature(actions): adjust how template cloning works and bump gradle #31
Conversation
ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]') | ||
SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]') | ||
SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]') | ||
GROUP="com.github.$SAFE_ACTOR.$SAFE_NAME" | ||
|
||
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/* | ||
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-cleanup/* | ||
sed -i "s/%GROUP%/$GROUP/g" .github/template-cleanup/* | ||
|
||
find src -type f -exec sed -i "s/org.jetbrains.plugins.template/$GROUP/g" {} + | ||
find src -type f -exec sed -i "s/Example Mod/$NAME/g" {} + | ||
find src -type f -exec sed -i "s/Authors/$ACTOR/g" {} + | ||
|
||
mkdir -p src/main/java/${GROUP//.//} | ||
cp -R .github/template-cleanup/. . | ||
cp -R src/main/java/com/example/* src/main/java/${GROUP//.//}/ | ||
|
||
rm -rf \ | ||
.github/template-cleanup \ | ||
.github/workflows/template-cleanup.yml \ | ||
.github/workflows/template-verify.yml \ | ||
LICENSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this back into a script file so you can still call the script without using github actions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
val baseGroup: String by project | ||
val mcVersion: String by project | ||
val version: String by project | ||
val mixinGroup = "$baseGroup.mixin" | ||
val modid: String by project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think those should stay as normal val
s here, since we use them in multiple places. Especially properties("modID").get()
everywhere is probably worse than declaring all of the properties here once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo it makes it more clear than just declaring a bunch of by projects. but i guess we can keep them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also use val mcVersion : String by project.properties
if you think that is more clear, or save the variables here using val modid = properties("modID").get()
We can use blossom for injecting the version into the |
some of this is definitely opionated. if needed I can remove the editorconfig and gradle aliases etc.
i also need to steup ID replacement, but I'm not sure if that should just be
%NAME%
lowercase, or something else with blossom maybe?:3333333