0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-13 01:30:46 -05:00

First pass at Discord notification

This commit is contained in:
Refringe 2024-03-11 11:22:01 -04:00
parent ab48800780
commit e4448fc9fa
Signed by: Refringe
GPG Key ID: 7715B85B4A6306ED

View File

@ -333,7 +333,7 @@ jobs:
overwrite: true
publish-release:
needs: [assemble-release]
needs: [assemble-release, determine-build-type]
runs-on: ubuntu-latest
container:
image: refringe/spt-build-node:1.0.4
@ -352,7 +352,7 @@ jobs:
shell: bash
- name: Upload Release to HTTPS Source
id: upload-https
id: upload-https-7z
run: |
cd /workspace/refringe/Build/
echo "${{ secrets.SFTP_HOST_KEY }}" > known_host
@ -367,7 +367,7 @@ jobs:
BASE_NAME="${BUILD_NAME%.7z}"
TORRENT_NAME="${BASE_NAME}.torrent"
TORF_OUTPUT=$(/opt/venv/bin/torf --yes --out "/workspace/refringe/Build/${TORRENT_NAME}" \
--webseed "${{ steps.upload-https.outputs.link_https }}" \
--webseed "${{ steps.upload-https-7z.outputs.link_https }}" \
--tracker "http://open.acgnxtracker.com:80/announce,https://tracker.tamersunion.org:443/announce,http://tracker.renfei.net:8080/announce,udp://tracker.torrent.eu.org:451/announce,udp://ec2-18-191-163-220.us-east-2.compute.amazonaws.com:6969/announce" \
--comment "Offical ${BASE_NAME} release, built by the team at sp-tarkov.com. Have fun!" \
--creator "sp-tarkov.com" \
@ -379,7 +379,7 @@ jobs:
shell: bash
- name: Upload Torrent to HTTPS Source
id: upload-https
id: upload-https-torrent
run: |
cd /workspace/refringe/Build/
echo "${{ secrets.SFTP_HOST_KEY }}" > known_host
@ -474,3 +474,50 @@ jobs:
mega-logout
shell: bash
- name: Post Build Info to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
BUILD_TYPE: ${{ needs.determine-build-type.outputs.build_type }}
BUILD_NAME: ${{ needs.assemble-release.outputs.build_name }}
DOWNLOAD_LINK: ${{ steps.upload-https-7z.outputs.link_https }}
TORRENT_LINK: ${{ steps.upload-https-torrent.outputs.link_torrent }}"
MAGNET_LINK: ${{ steps.create-torrent.outputs.magnet_link }}
run: |
FOOTER_MESSAGES=("You look great today!" "Powered by coffee" "Did you remember to hydrate today?" "Have you tried turning it off and on again?" "In Chomp we trust" "Beep boop, I'm a bot" "Keep calm and commit your code" "May the source be with you" "Go to bed, Terk" "Please direct all support requests to Drakia" "Meaw")
FOOTER_MESSAGE="${FOOTER_MESSAGES[$RANDOM % ${#FOOTER_MESSAGES[@]}]}"
TIMESTAMP=$(date --iso-8601=seconds)
if [ "$BUILD_TYPE" == "bleeding" ]; then
EMBED_COLOR=14423100
EMBED_TITLE="A New BLEEDING Build Released"
EMBED_DESCRIPTION="A new bleeding build is now available for download. Mods are disabled for bleeding builds. 7-Zip is *required* to extract the release."
elif [ "$BUILD_TYPE" == "debug" ]; then
EMBED_COLOR=5789784
EMBED_TITLE="New DEBUG Build Available"
EMBED_DESCRIPTION="A new debug build is now available for download. Mods are disabled for debug builds. 7-Zip is *required* to extract the release."
else
EMBED_COLOR=1374720
EMBED_TITLE="Release Build Now Available"
EMBED_DESCRIPTION="A new stable release build is now ready for download. 7-Zip is *required* to extract the release."
fi
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"content": "✨ **New Build Available!** ✨ (THIS IS A TEST)",
"embeds": [
{
"title": "'"$EMBED_TITLE"'",
"description": "'"$EMBED_DESCRIPTION"'\n\n**Build Name:**\n'"$BUILD_NAME"'\n\n🚀 **Primary Download Link:**\n'"$DOWNLOAD_LINK"'\n\n🔗 **Torrent Link:**\n'"$TORRENT_LINK"'\n\n🧲 **Torrent Magnet Link:**\n'"$MAGNET_LINK"'\n\n**Mirrors:**\n\n🚧 In order to conserve bandwidth, please consider using the *above* methods to download the release. If you have issues using those methods, you\'re free to download using any of the following HTTP mirrors.\n\n⚠ While the links *below* are not secret, **do not advertise them**. The primary MEGA link or torrent should be used to advertise any downloads.\n\n'"$DOWNLOAD_LINK"'",
"url": "'"$DOWNLOAD_LINK"'",
"color": $EMBED_COLOR,
"footer": {
"text": "'"$FOOTER_MESSAGE"'"
},
"timestamp": "'"$TIMESTAMP"'"
}
],
"flags": 4100
}' \
$DISCORD_WEBHOOK_URL