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

@ -80,7 +80,9 @@ check() {
command+="-f \"ref=$BRANCH\" -f \"inputs[runNext]=true\" " command+="-f \"ref=$BRANCH\" -f \"inputs[runNext]=true\" "
if [[ "$IS_GLOBAL" == "true" ]]; then if [[ "$IS_GLOBAL" == "true" ]]; then
command+="-f \"inputs[oldTailscaleHostname]=$hostname\"" command+="-f \"inputs[oldTailscaleHostname]=$hostname\" "
command+="-f \"inputs[name]=$NAME\""
cd /mnt/globalData/toBackup cd /mnt/globalData/toBackup