Bump version to 2.6.3 #117
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
name: Discord CI | |
on: | |
push: | |
branches: | |
- main | |
- hotfix | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Build with Maven | |
run: | | |
mvn clean package | |
- name: Check for Signatures on VirusTotal | |
run: | | |
file=$(find "./TradeSystem-Bundle/target" -type f -name "TradeSystem_v*.jar" | head -n 1) | |
key=${{ secrets.VIRUSTOTAL }} | |
echo "Checking for virus detection..." | |
url='https://www.virustotal.com/vtapi/v2/file/scan' | |
response=$(curl -F apikey=$key -F file=@$file $url) | |
resource=$(echo "$response" | jq -r '.resource') | |
msg=$(echo "$response" | jq -r '.verbose_msg') | |
if [ "$resource" = null ] | |
then | |
echo "::error::Could not run VirusTotal check. Message: $msg" | |
else | |
echo "Retrieving scan for resource '$resource'..." | |
while | |
if [ -n "$response_code" ] | |
then | |
sleep 25 | |
fi | |
url='https://www.virustotal.com/vtapi/v2/file/report' | |
response=$(curl -F apikey=$key -F resource="$resource" $url) | |
response_code=$(echo "$response" | jq -r '.response_code') | |
[ ! "$response_code" = "1" ] | |
do :; done | |
positives=$(echo "$response" | jq -r '.positives') | |
link=$(echo "$response" | jq -r '.permalink') | |
if [ "$positives" = "0" ] | |
then | |
echo "No virus detected." | |
exit 0 | |
else | |
echo "$positives virus(es) detected! Link: $link" | |
exit 1 | |
fi | |
fi | |
- name: Deploy | |
run: | | |
rank="<@&793495434235609138>" | |
milestone=47 | |
upload() { | |
file=$(find "./TradeSystem-Bundle/target" -type f -name "TradeSystem_v*.jar" | head -n 1) | |
name=${file##*/} | |
name=${name[@]//.jar/} | |
info=${name##*_} | |
version=${name:12} | |
version=${version[@]//_$info/} | |
if [ $info == $version ] | |
then | |
info="New release**__ - __**" | |
else | |
info=${info[@]//-/ } | |
info="$info**__ - __**" | |
fi | |
NOW="$(LC_ALL=en_GB.utf8 date --universal)" | |
echo "Sending '$file' to 'DevBuilds' channel, this may take a while..." | |
curl -i -H 'Expect: application/json' -F file=@"$file" -F "payload_json={ \"wait\": true, \"avatar_url\":\"https://i.imgur.com/x3pSH55.png\", \"content\": \"$rank\n__**$info$version**__ [$NOW]\n\n**Changelog:**\n<https://github.com/CodingAir/TradeSystem/milestone/$milestone?closed=1>\", \"username\": \"TradeSystem CI\" }" $1 | |
} | |
upload ${{ secrets.DISCORD_WEBHOOK }} |