Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Conversation

pauliesnug
Copy link

@pauliesnug pauliesnug commented Apr 28, 2024

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

.editorconfig Outdated Show resolved Hide resolved
.editorconfig Outdated Show resolved Hide resolved
Comment on lines 20 to 41
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
Copy link
Owner

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure!

Comment on lines -13 to -17
val baseGroup: String by project
val mcVersion: String by project
val version: String by project
val mixinGroup = "$baseGroup.mixin"
val modid: String by project
Copy link
Owner

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 vals here, since we use them in multiple places. Especially properties("modID").get() everywhere is probably worse than declaring all of the properties here once.

Copy link
Author

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

Copy link
Owner

@nea89o nea89o Apr 29, 2024

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()

.github/workflows/template-cleanup.yml Outdated Show resolved Hide resolved
@nea89o
Copy link
Owner

nea89o commented Apr 28, 2024

blossom maybe

We can use blossom for injecting the version into the @Mod annotation, but i dont think we need it for the general template initialization. Maybe in another PR.

@pauliesnug pauliesnug closed this by deleting the head repository Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants