Update .travis.yml #2432
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: Server Notice Action | |
on: push | |
jobs: | |
deploy: | |
name: notice mcrcon | |
runs-on: ubuntu-latest | |
steps: | |
- name: Public IP | |
id: ip | |
uses: haythem/[email protected] | |
- name: Print Public IP | |
run: | | |
echo ${{ steps.ip.outputs.ipv4 }} | |
echo ${{ steps.ip.outputs.ipv6 }} | |
- uses: actions/checkout@v2 | |
- name: Add Firewalld IP Address | |
id: FIREWALL | |
run: | | |
ADD_FIREWALL=`curl "https://api.vultr.com/v2/firewalls/${{ secrets.VULTR_FIREWALL_GROUP_ID }}/rules" \ | |
-X POST \ | |
-H "Authorization: Bearer ${{ secrets.VULTR_API_KEY }}" \ | |
-H "Content-Type: application/json" \ | |
--data '{ | |
"ip_type": "v4", | |
"protocol": "tcp", | |
"port": "${{ secrets.TUSB_SERVER_RCON_PORT }}", | |
"subnet": "${{ steps.ip.outputs.ipv4 }}", | |
"subnet_size": 32, | |
"source": "", | |
"notes": "GitHub Action Firewall Rule on Rcon Port" | |
}'` | |
firewall_id=`echo "$ADD_FIREWALL" | jq '.firewall_rule.id'` | |
echo "::set-output name=ID::$firewall_id" | |
echo "-----DEBUG-----" | |
echo "$ADD_FIREWALL" | |
- name: Install mcrcon | |
run: | | |
wget https://github.com/Tiiffi/mcrcon/releases/download/v0.7.1/mcrcon-0.7.1-linux-x86-64.tar.gz | |
tar -zxvf mcrcon-0.7.1-linux-x86-64.tar.gz | |
mv mcrcon-0.7.1-linux-x86-64/mcrcon /usr/local/bin/ | |
- name: Set outputs | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Check outputs | |
run: echo ${{ steps.vars.outputs.sha_short }} | |
- name: Sleep for 45 seconds | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '45s' | |
- name: Notice Bungeecord | |
run: | | |
/usr/local/bin/mcrcon -H ${{ secrets.TUSB_MINECRAFT_SERVER_REMOTE_HOST_IP }} -p ${{ secrets.TUSB_SERVER_RCON_PASSWORD }} -P ${{ secrets.TUSB_SERVER_RCON_PORT }} -w 5 "alertraw [\"\",{\"text\":\"[INFO] \"},{\"text\":\"\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u66f4\u65b0\u3055\u308c\u307e\u3057\u305f\u3002\",\"bold\":true,\"color\":\"yellow\"},{\"text\":\"(Hash: \"},{\"text\":\"${{ steps.vars.outputs.sha_short }}\",\"italic\":true,\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://github.com/TUSB/TheUnusualSkyBlock/commit/${{ steps.vars.outputs.sha_short }}\"}},{\"text\":\")\"}]" | |
- if: always() | |
name: Delete Firewalld IP Address | |
run: | | |
DELETE_FIREWALL=$(curl "https://api.vultr.com/v2/firewalls/${{ secrets.VULTR_FIREWALL_GROUP_ID }}/rules/${{ steps.FIREWALL.outputs.ID }}" \ | |
-X DELETE \ | |
-H 'Authorization: Bearer ${{ secrets.VULTR_API_KEY }}') | |
echo $DELETE_FIREWALL | |
echo "-----DEBUG-----" | |
echo "$DELETE_FIREWALL" |