2024-11-02 23:36:38 -04:00
|
|
|
name: Run
|
2024-10-03 23:44:27 -04:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
runNext:
|
|
|
|
description: 'Should run next'
|
|
|
|
required: true
|
|
|
|
default: true
|
|
|
|
type: boolean
|
2024-10-23 01:09:55 -04:00
|
|
|
name:
|
|
|
|
description: 'Machine name'
|
|
|
|
required: true
|
|
|
|
default: 'global'
|
|
|
|
type: string
|
2024-10-05 21:11:19 -04:00
|
|
|
oldTailscaleHostname:
|
|
|
|
description: 'Old Tailscale Hostname (not needed)'
|
|
|
|
required: false
|
|
|
|
default: ''
|
|
|
|
type: string
|
2024-10-03 23:44:27 -04:00
|
|
|
|
|
|
|
permissions: write-all
|
|
|
|
|
2024-10-10 04:50:58 -04:00
|
|
|
env:
|
2024-10-16 06:07:14 -04:00
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
|
|
|
|
2024-10-03 23:44:27 -04:00
|
|
|
jobs:
|
|
|
|
custom:
|
2024-10-10 06:29:13 -04:00
|
|
|
runs-on: ubuntu-24.04
|
2024-10-03 23:44:27 -04:00
|
|
|
steps:
|
2024-10-18 02:15:54 -04:00
|
|
|
- name: Setup Python (for use with Page flying on a Kite)
|
2024-10-10 04:50:58 -04:00
|
|
|
uses: actions/setup-python@v5
|
2024-10-03 23:44:27 -04:00
|
|
|
with:
|
|
|
|
python-version: '3.11'
|
2024-10-18 02:15:54 -04:00
|
|
|
- name: Setup Java 21 (Eclipse Temurin) // !!! broken, does nothing
|
2024-10-14 22:31:28 -04:00
|
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '21'
|
2024-10-10 04:50:58 -04:00
|
|
|
- name: Installs some stuff
|
2024-10-03 23:44:27 -04:00
|
|
|
run: |
|
|
|
|
sudo apt update -y
|
2024-10-16 06:02:12 -04:00
|
|
|
sudo apt install mosh -y
|
2024-10-10 07:10:30 -04:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2024-10-03 23:44:27 -04:00
|
|
|
curl -fsSL https://tailscale.com/install.sh | sh
|
|
|
|
|
2024-10-06 02:03:50 -04:00
|
|
|
npm install -g serve
|
2024-10-18 02:15:54 -04:00
|
|
|
- name: Change Security Word
|
2024-10-10 04:50:58 -04:00
|
|
|
run: echo "$(whoami):password1!" | sudo chpasswd
|
2024-10-18 02:15:54 -04:00
|
|
|
- name: Start the scale to measure the weight of this server
|
2024-10-23 01:09:55 -04:00
|
|
|
run: sudo tailscale up --hostname="$(if ${{ inputs.runNext }}; then echo ${{ inputs.name }}; else echo manual-${{ inputs.name }}-$(TZ=Asia/Tokyo date +%H-%M-%S); fi)" --advertise-exit-node --ssh --authkey ${{ secrets.TAILSCALE_KEY }}
|
2024-10-10 04:50:58 -04:00
|
|
|
- name: Fix the PS having no colors
|
2024-10-18 02:15:54 -04:00
|
|
|
# the problem is actually the bash_profile on runner's home
|
|
|
|
# but i was too lazy and simply did this (works too)
|
2024-10-10 04:50:58 -04:00
|
|
|
run: |
|
2024-10-03 23:44:27 -04:00
|
|
|
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
|
2024-10-10 04:50:58 -04:00
|
|
|
- name: Kill something :D
|
|
|
|
run: sudo pkill provjobd
|
2024-10-18 02:15:54 -04:00
|
|
|
- name: Create the global data directory and set permissions
|
2024-10-03 23:44:27 -04:00
|
|
|
run: |
|
2024-10-07 07:24:46 -04:00
|
|
|
sudo mkdir /mnt/globalData
|
2024-10-07 21:41:32 -04:00
|
|
|
sudo chown $(whoami) /mnt/globalData/
|
2024-10-11 22:49:59 -04:00
|
|
|
- name: Dump GitHub token, GitHub context and other environment variables to the home directory (useful for debugging purposes)
|
2024-10-11 02:24:16 -04:00
|
|
|
env:
|
|
|
|
GITHUB_CONTEXT: ${{ toJSON(github) }}
|
2024-10-10 23:24:39 -04:00
|
|
|
run: |
|
2024-10-11 02:24:16 -04:00
|
|
|
echo "$GITHUB_CONTEXT" >> ~/github_context.txt
|
2024-10-10 23:24:39 -04:00
|
|
|
echo "$GH_TOKEN" > ~/gh_token.txt
|
|
|
|
env >> ~/env.txt
|
2024-10-11 22:49:59 -04:00
|
|
|
- name: Get files from old runtime (if exists)
|
|
|
|
if: ${{ inputs.oldTailscaleHostname != '' }}
|
2024-10-03 23:44:27 -04:00
|
|
|
run: |
|
2024-10-11 22:49:59 -04:00
|
|
|
cd /mnt/globalData
|
|
|
|
|
|
|
|
aria2c -x 16 -j 16 -s 16 http://${{ inputs.oldTailscaleHostname }}:5000/archive.tar.gz
|
2024-10-07 00:16:34 -04:00
|
|
|
|
2024-10-11 22:49:59 -04:00
|
|
|
tar xf archive.tar.gz
|
|
|
|
rm -rf archive.tar.gz
|
2024-10-12 21:38:44 -04:00
|
|
|
- name: Run post-install script (if exists)
|
2024-10-20 19:52:27 -04:00
|
|
|
working-directory: /mnt/globalData
|
2024-10-12 21:38:44 -04:00
|
|
|
run: |
|
2024-10-20 19:52:27 -04:00
|
|
|
if [ -f toBackup/postinstall.sh ]; then
|
|
|
|
. toBackup/postinstall.sh &
|
2024-10-12 21:38:44 -04:00
|
|
|
fi
|
2024-10-11 22:49:59 -04:00
|
|
|
- name: Run the long-lived process
|
|
|
|
working-directory: /mnt/globalData
|
|
|
|
run: |
|
2024-11-02 23:36:38 -04:00
|
|
|
wget https://raw.githubusercontent.com/Frail7487Real/laughing-spork/refs/heads/master/checkTime.js
|
2024-10-10 22:26:05 -04:00
|
|
|
|
2024-11-02 23:36:38 -04:00
|
|
|
wget https://raw.githubusercontent.com/Frail7487Real/laughing-spork/refs/heads/master/loop.sh
|
2024-10-04 00:35:56 -04:00
|
|
|
chmod +x loop.sh
|
2024-10-11 22:49:59 -04:00
|
|
|
|
2024-10-18 02:15:54 -04:00
|
|
|
# what an argument mess
|
2024-11-02 23:36:38 -04:00
|
|
|
bash loop.sh ${{ inputs.runNext }} $GH_TOKEN laughing-spork runglobal.yml master ${{ inputs.name }} $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }}
|