-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from flytegg/feat/auto-deploy
Add auto-deployment
- Loading branch information
Showing
6 changed files
with
112 additions
and
13 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,72 @@ | ||
name: Compile & Deploy Gradle Jar | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: "adopt" | ||
java-version: "17" | ||
|
||
- name: Make gradlew executable | ||
run: chmod +x ./gradlew | ||
|
||
- name: Cache Gradle Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: gradle-${{ runner.os }}- | ||
|
||
- name: Create build directory | ||
run: mkdir -p build | ||
|
||
- name: Gradle build | ||
run: | | ||
echo "REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV | ||
./gradlew build -PoutputDir=build | ||
- name: Install JQ | ||
run: sudo apt-get install jq | ||
|
||
- name: Obtain Pterodactyl upload endpoint | ||
run: | | ||
response=$(curl "https://${{ vars.PTERO_HOST }}/api/client/servers/${{ vars.PTERO_SERVER_ID }}/files/upload" \ | ||
-H 'Accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Authorization: Bearer ${{ secrets.PTERO_API_KEY }}' \ | ||
-X GET) | ||
url=$(echo "$response" | jq -r .attributes.url) | ||
echo "URL=$url" >> $GITHUB_ENV | ||
- name: Upload jar to Pterodactyl upload endpoint | ||
run: | | ||
echo $URL | ||
echo $REPO_NAME | ||
file=$(ls build/libs/$REPO_NAME.jar) | ||
curl "$URL&directory=/plugins" \ | ||
-H 'Content-Type: multipart/form-data' \ | ||
-F "files=@$file" \ | ||
-X POST | ||
- name: Restart Pterodactyl server | ||
run: | | ||
curl "https://${{ vars.PTERO_HOST }}/api/client/servers/${{ vars.PTERO_SERVER_ID }}/power" \ | ||
-H 'Accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Authorization: Bearer ${{ secrets.PTERO_API_KEY }}' \ | ||
-X POST \ | ||
-d '{ | ||
"signal": "restart" | ||
}' |
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
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
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
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
23 changes: 17 additions & 6 deletions
23
src/main/kotlin/com/learnspigot/bot/verification/VerificationMessage.kt
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 |
---|---|---|
@@ -1,32 +1,43 @@ | ||
package com.learnspigot.bot.verification | ||
|
||
import com.learnspigot.bot.Environment | ||
import com.learnspigot.bot.Server | ||
import com.learnspigot.bot.util.embed | ||
import net.dv8tion.jda.api.entities.Guild | ||
import net.dv8tion.jda.api.entities.MessageHistory | ||
import net.dv8tion.jda.api.interactions.components.buttons.Button | ||
|
||
class VerificationMessage(guild: Guild) { | ||
|
||
init { | ||
guild.getTextChannelById(Environment.get("VERIFY_CHANNEL_ID"))!!.sendMessageEmbeds( | ||
// Clean up old message(s) | ||
MessageHistory.getHistoryFromBeginning(Server.verifyChannel) | ||
.complete().retrievedHistory.forEach { message -> message.delete().queue() } | ||
|
||
// Send new message | ||
Server.verifyChannel.sendMessageEmbeds( | ||
embed() | ||
.setTitle("VERIFY YOU OWN THE COURSE") | ||
.setDescription(""" | ||
.setDescription( | ||
""" | ||
Welcome to the Discord for the LearnSpigot course! | ||
:disappointed: **Don't own the course? See """.trimIndent() + guild.getTextChannelById(Environment.get("GET_COURSE_CHANNEL_ID"))!!.asMention + """ | ||
:disappointed: **Don't own the course? See """.trimIndent() + guild.getTextChannelById( | ||
Environment.get("GET_COURSE_CHANNEL_ID") | ||
)!!.asMention + """ | ||
** | ||
The URL you need to use is the link to your public profile, to get this: | ||
:one: Hover over your profile picture in the top right on Udemy | ||
:two: Select "Public profile" from the dropdown menu | ||
:three: Copy the link from your browser | ||
Please make sure that you have [privacy settings](https://www.udemy.com/instructor/profile/privacy/) enabled so that we can verify you own the course.""".trimIndent()) | ||
Please make sure that you have [privacy settings](https://www.udemy.com/instructor/profile/privacy/) enabled so that we can verify you own the course.""".trimIndent() | ||
) | ||
.setFooter("Once you've verified, you'll have access to our 50 man support team, hundreds of additional tutorials and a supportive community.") | ||
.build()) | ||
.build() | ||
) | ||
.addActionRow(Button.success("verify", "Click to Verify")) | ||
.queue() | ||
} | ||
|
||
} |