Skip to content

Commit

Permalink
Add upload2 task to upload to the second server
Browse files Browse the repository at this point in the history
  • Loading branch information
29cmb committed Dec 6, 2024
1 parent 3233ed0 commit 6d18a00
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
default: ''

jobs:
upload:
upload1:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install SSH client and sshpass
run: sudo apt-get update && sudo apt-get install -y openssh-client sshpass

- name: Download server.properties
- name: Download server.properties for the hub server
env:
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_DOMAIN: ${{ secrets.SSH_DOMAIN }}
Expand All @@ -35,20 +35,62 @@ jobs:
bye
EOF
- name: Update server.properties
- name: Update server.properties for the hub server
env:
RESOURCE_PACK_URL: ${{ github.event.inputs.resource_pack_url }}
RESOURCE_PACK_HASH: ${{ github.event.inputs.resource_pack_hash }}
run: |
sed -i "s|^resource-pack=.*|resource-pack=${RESOURCE_PACK_URL}|" server.properties
sed -i "s|^resource-pack-sha1=.*|resource-pack-sha1=${RESOURCE_PACK_HASH}|" server.properties
- name: Upload server.properties
- name: Upload server.properties back to the hub server
env:
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_DOMAIN: ${{ secrets.SSH_DOMAIN }}
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
run: |
sshpass -p $SSH_PASSWORD sftp -o StrictHostKeyChecking=no -P $SSH_PORT $SSH_USERNAME@$SSH_DOMAIN << EOF
put server.properties server.properties
bye
EOF
upload2:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install SSH client and sshpass
run: sudo apt-get update && sudo apt-get install -y openssh-client sshpass

- name: Download server.properties for the minigames server
env:
SSH_USERNAME: ${{ secrets.SSH_USERNAME2 }}
SSH_DOMAIN: ${{ secrets.SSH_DOMAIN2 }}
SSH_PORT: ${{ secrets.SSH_PORT2 }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD2 }}
run: |
sshpass -p $SSH_PASSWORD sftp -o StrictHostKeyChecking=no -P $SSH_PORT $SSH_USERNAME@$SSH_DOMAIN << EOF
get server.properties server.properties
bye
EOF
- name: Update server.properties for the minigames server
env:
RESOURCE_PACK_URL: ${{ github.event.inputs.resource_pack_url }}
RESOURCE_PACK_HASH: ${{ github.event.inputs.resource_pack_hash }}
run: |
sed -i "s|^resource-pack=.*|resource-pack=${RESOURCE_PACK_URL}|" server.properties
sed -i "s|^resource-pack-sha1=.*|resource-pack-sha1=${RESOURCE_PACK_HASH}|" server.properties
- name: Upload server.properties back to the minigames server
env:
SSH_USERNAME: ${{ secrets.SSH_USERNAME2 }}
SSH_DOMAIN: ${{ secrets.SSH_DOMAIN2 }}
SSH_PORT: ${{ secrets.SSH_PORT2 }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD2 }}
run: |
sshpass -p $SSH_PASSWORD sftp -o StrictHostKeyChecking=no -P $SSH_PORT $SSH_USERNAME@$SSH_DOMAIN << EOF
put server.properties server.properties
Expand Down

0 comments on commit 6d18a00

Please sign in to comment.