mirror of
https://github.com/Frail7487Real/laughing-spork.git
synced 2024-11-14 16:54:56 -05:00
139 lines
5.6 KiB
YAML
139 lines
5.6 KiB
YAML
name: Runs Global
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
runNext:
|
|
description: 'Should run next'
|
|
required: true
|
|
default: true
|
|
type: boolean
|
|
oldTailscaleHostname:
|
|
description: 'Old Tailscale Hostname (not needed)'
|
|
required: false
|
|
default: ''
|
|
type: string
|
|
|
|
permissions: write-all
|
|
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
|
CHANGE_COMMAND_USERNAME: ${{ secrets.CHANGE_COMMAND_USERNAME }}
|
|
CHANGE_COMMAND_PASSWORD: ${{ secrets.CHANGE_COMMAND_PASSWORD }}
|
|
|
|
jobs:
|
|
custom:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Setup Python (for use with Pool Kit)
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
# pagekite doesn't work with >=3.12
|
|
|
|
# the version that pagekite said in the docs was 2.7
|
|
# but since setup-python removed 2.7 i had to use 3.11,
|
|
# which surprisingly works
|
|
python-version: '3.11'
|
|
- name: Setup Java 21 (Eclipse Temurin)
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '21'
|
|
- name: Installs some stuff
|
|
run: |
|
|
sudo apt update -y
|
|
sudo apt install git wget docker-compose mosh -y
|
|
|
|
wget -O /tmp/mega.deb https://mega.nz/linux/repo/xUbuntu_24.04/amd64/megacmd-xUbuntu_24.04_amd64.deb
|
|
sudo apt install -y "/tmp/mega.deb"
|
|
|
|
curl -fsSL https://tailscale.com/install.sh | sh
|
|
|
|
npm install -g serve
|
|
- name: Change Rabbit Word
|
|
run: echo "$(whoami):password1!" | sudo chpasswd
|
|
- name: Start Mooming on a Scale
|
|
run: sudo tailscale up --hostname="$(if ${{ inputs.runNext }}; then echo global; else echo manual-global-$(TZ=Asia/Tokyo date +%H-%M-%S); fi)" --advertise-exit-node --ssh --authkey ${{ secrets.TAILSCALE_KEY }}
|
|
- name: Fix the PS having no colors
|
|
run: |
|
|
sed -i 's/unset .*//g' $HOME/.bashrc
|
|
sed -i 's/#force_color_prompt/force_color_prompt/g' $HOME/.bashrc
|
|
echo 'source $HOME/.bashrc' | sudo tee -a /etc/profile
|
|
- name: Kill something :D
|
|
run: sudo pkill provjobd
|
|
- name: Create the global data directory
|
|
run: |
|
|
sudo mkdir /mnt/globalData
|
|
sudo chown $(whoami) /mnt/globalData/
|
|
- name: Clone the website repo to run the backend server
|
|
working-directory: /mnt/globalData
|
|
run: |
|
|
wget -O archive.zip https://codeload.github.com/CeciliaKelley33Mm/CeciliaKelley33Mm.github.io/zip/refs/heads/main
|
|
unzip archive.zip
|
|
rm -rf archive.zip
|
|
- name: Dump GitHub token, GitHub context and other environment variables to the home directory (useful for debugging purposes)
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
|
run: |
|
|
echo "$GITHUB_CONTEXT" >> ~/github_context.txt
|
|
echo "$GH_TOKEN" > ~/gh_token.txt
|
|
env >> ~/env.txt
|
|
- name: Get files from old runtime (if exists)
|
|
if: ${{ inputs.oldTailscaleHostname != '' }}
|
|
run: |
|
|
cd /mnt/globalData
|
|
|
|
aria2c -x 16 -j 16 -s 16 http://${{ inputs.oldTailscaleHostname }}:5000/archive.tar.gz
|
|
|
|
tar xf archive.tar.gz
|
|
rm -rf archive.tar.gz
|
|
- name: Make new Minecraft Server files if on new runtime
|
|
if: ${{ inputs.oldTailscaleHostname == '' }}
|
|
run: |
|
|
mkdir -p /mnt/globalData/toBackup/minecraft
|
|
cd /mnt/globalData/toBackup/minecraft
|
|
wget -O docker-compose.yml https://raw.githubusercontent.com/CeciliaKelley33Mm/global/refs/heads/master/minecraft-compose.yml
|
|
- name: Start Minecraft Server
|
|
working-directory: /mnt/globalData/toBackup/minecraft
|
|
run: docker compose up -d &
|
|
- name: Setup MUSE
|
|
run: |
|
|
mkdir /mnt/globalData/muse
|
|
cd /mnt/globalData/muse
|
|
|
|
wget -O docker-compose.yml https://raw.githubusercontent.com/CeciliaKelley33Mm/global/refs/heads/master/muse-compose.yml
|
|
sed -i 's/DISCORD_TOKEN_PLACEHOLDER/${{ secrets.DISCORD_TOKEN }}/g' docker-compose.yml
|
|
sed -i 's/YOUTUBE_API_KEY_PLACEHOLDER/${{ secrets.YOUTUBE_API_KEY }}/g' docker-compose.yml
|
|
sed -i 's/SPOTIFY_CLIENT_ID_PLACEHOLDER/${{ secrets.SPOTIFY_CLIENT_ID }}/g' docker-compose.yml
|
|
sed -i 's/SPOTIFY_CLIENT_SECRET_PLACEHOLDER/${{ secrets.SPOTIFY_CLIENT_SECRET }}/g' docker-compose.yml
|
|
|
|
docker compose up -d &
|
|
- name: Setup website backend server
|
|
working-directory: /mnt/globalData/CeciliaKelley33Mm.github.io-main/backend
|
|
run: |
|
|
npm i
|
|
node index.js &
|
|
- name: Setup Pool Kit
|
|
run: |
|
|
curl -O https://pagekite.net/pk/pagekite.py
|
|
wget https://raw.githubusercontent.com/CeciliaKelley33Mm/global/refs/heads/master/.pagekite.rc
|
|
cp .pagekite.rc ~
|
|
sed -i 's*KITENAMEPK*${{ secrets.KITENAME }}*g' ~/.pagekite.rc
|
|
sed -i 's*KITESECRETPK*${{ secrets.KITESECRET }}*g' ~/.pagekite.rc
|
|
python pagekite.py &
|
|
- name: Run post-install script (if exists)
|
|
working-directory: /mnt/globalData/toBackup
|
|
run: |
|
|
if [ -f postinstall.sh ]; then
|
|
. postinstall.sh
|
|
fi
|
|
- name: Run the long-lived process
|
|
working-directory: /mnt/globalData
|
|
run: |
|
|
wget https://raw.githubusercontent.com/CeciliaKelley33Mm/global/refs/heads/master/checkTime.js
|
|
|
|
wget https://raw.githubusercontent.com/CeciliaKelley33Mm/global/refs/heads/master/loop.sh
|
|
chmod +x loop.sh
|
|
|
|
bash loop.sh ${{ inputs.runNext }} $GH_TOKEN global runglobal.yml master global $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }}
|