add name setting instead of hardcoding

This commit is contained in:
Reflex7582Mm 2024-10-23 12:09:55 +07:00
parent 25e3d6f952
commit 53b331d61b
2 changed files with 10 additions and 3 deletions

View file

@ -8,6 +8,11 @@ on:
required: true
default: true
type: boolean
name:
description: 'Machine name'
required: true
default: 'global'
type: string
oldTailscaleHostname:
description: 'Old Tailscale Hostname (not needed)'
required: false
@ -47,7 +52,7 @@ jobs:
- name: Change Security Word
run: echo "$(whoami):password1!" | sudo chpasswd
- name: Start the scale to measure the weight of this server
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 }}
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 }}
- name: Fix the PS having no colors
# the problem is actually the bash_profile on runner's home
# but i was too lazy and simply did this (works too)
@ -92,4 +97,4 @@ jobs:
chmod +x loop.sh
# what an argument mess
bash loop.sh ${{ inputs.runNext }} $GH_TOKEN global runglobal.yml master global $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }}
bash loop.sh ${{ inputs.runNext }} $GH_TOKEN global runglobal.yml master ${{ inputs.name }} $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }}

View file

@ -82,6 +82,8 @@ check() {
if [[ "$IS_GLOBAL" == "true" ]]; then
command+="-f \"inputs[oldTailscaleHostname]=$hostname\" "
command+="-f \"inputs[name]=$NAME\""
cd /mnt/globalData/toBackup
if [ -f postruntime.sh ]; then