From b6ae89dff82c447cae8b385c7f873b2c02676b9b Mon Sep 17 00:00:00 2001 From: fucksophie Date: Tue, 10 Mar 2026 00:42:26 +0200 Subject: [PATCH 1/4] github deployprod.yml --- .github/workflows/deploy-prod.yml | 25 +++++++++++++++++++++++++ LICENSE | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-prod.yml diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 00000000..b4319f7b --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,25 @@ +name: Deploy Client + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts + + - name: Rsync Client to Server + run: | + rsync -avz --delete client/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }} diff --git a/LICENSE b/LICENSE index d1fd5af0..784ff08c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Lapis +Copyright (c) 2026 multiplayerpiano.net contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 4f3d942a95a70074b9765fd6a46276d9a492c14b Mon Sep 17 00:00:00 2001 From: fucksophie Date: Tue, 10 Mar 2026 00:45:37 +0200 Subject: [PATCH 2/4] wtf was i doing lmaooo --- .github/workflows/deploy-prod.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index b4319f7b..86c6bdc0 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -1,18 +1,15 @@ -name: Deploy Client +name: Deploy Client via Git on: push: branches: - - main + - main # deploy only on main branch jobs: deploy: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Setup SSH key run: | mkdir -p ~/.ssh @@ -20,6 +17,16 @@ jobs: chmod 600 ~/.ssh/id_rsa ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts - - name: Rsync Client to Server + - name: Deploy via Git run: | - rsync -avz --delete client/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }} + ssh ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} bash -c ' + TARGET_DIR=${{ secrets.DEPLOY_PATH }} + mkdir -p $(dirname "$TARGET_DIR") + if [ -d "$TARGET_DIR/.git" ]; then + echo "Pulling latest changes..." + cd $TARGET_DIR && git fetch --all && git reset --hard origin/main + else + echo "Cloning repo..." + git clone https://github.com/mppnet/frontend.git $TARGET_DIR + fi + ' From 31483df6a08f1b6ef505bb49ba9f5a5c89c30834 Mon Sep 17 00:00:00 2001 From: fucksophie Date: Tue, 10 Mar 2026 00:48:34 +0200 Subject: [PATCH 3/4] finish workflow --- .github/workflows/deploy-prod.yml | 32 ------------------------- .github/workflows/deploy.yml | 40 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/deploy-prod.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml deleted file mode 100644 index 86c6bdc0..00000000 --- a/.github/workflows/deploy-prod.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Deploy Client via Git - -on: - push: - branches: - - main # deploy only on main branch - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Setup SSH key - run: | - mkdir -p ~/.ssh - echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts - - - name: Deploy via Git - run: | - ssh ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} bash -c ' - TARGET_DIR=${{ secrets.DEPLOY_PATH }} - mkdir -p $(dirname "$TARGET_DIR") - if [ -d "$TARGET_DIR/.git" ]; then - echo "Pulling latest changes..." - cd $TARGET_DIR && git fetch --all && git reset --hard origin/main - else - echo "Cloning repo..." - git clone https://github.com/mppnet/frontend.git $TARGET_DIR - fi - ' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..0d5886c7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: Deploy Client + +on: + push: + branches: + - main + - dev + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Setup SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts + + - name: Deploy via Git + run: | + if [ "${GITHUB_REF##*/}" = "main" ]; then + TARGET_PATH="${{ secrets.DEPLOY_PATH }}" + elif [ "${GITHUB_REF##*/}" = "dev" ]; then + TARGET_PATH="${{ secrets.DEPLOY_PATH_DEV }}" + else + echo "Branch not configured for deployment. Exiting." + exit 0 + fi + + ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \ + "mkdir -p \"\$TARGET_PATH\"; \ + if [ -d \"\$TARGET_PATH/.git\" ]; then \ + echo 'Pulling latest changes...'; \ + cd \"\$TARGET_PATH\" && git fetch --all && git reset --hard origin/${GITHUB_REF##*/}; \ + else \ + echo 'Cloning repo...'; \ + git clone -b ${GITHUB_REF##*/} https://github.com/mppnet/frontend.git \"\$TARGET_PATH\"; \ + fi" From 85f178a2a00401dbeaacfa8eb0e409bc5e2e20d6 Mon Sep 17 00:00:00 2001 From: fucksophie Date: Tue, 10 Mar 2026 00:49:36 +0200 Subject: [PATCH 4/4] Update deploy.yml --- .github/workflows/deploy.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0d5886c7..07774728 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,21 +20,20 @@ jobs: - name: Deploy via Git run: | - if [ "${GITHUB_REF##*/}" = "main" ]; then - TARGET_PATH="${{ secrets.DEPLOY_PATH }}" - elif [ "${GITHUB_REF##*/}" = "dev" ]; then - TARGET_PATH="${{ secrets.DEPLOY_PATH_DEV }}" - else - echo "Branch not configured for deployment. Exiting." + BRANCH=${GITHUB_REF##*/} + if [ "$BRANCH" != "main" ] && [ "$BRANCH" != "dev" ]; then + echo "Branch $BRANCH not configured for deployment. Exiting." exit 0 fi + DEPLOY_PATH=$([[ "$BRANCH" == "main" ]] && echo "${{ secrets.DEPLOY_PATH }}" || echo "${{ secrets.DEPLOY_PATH_DEV }}") + ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \ - "mkdir -p \"\$TARGET_PATH\"; \ - if [ -d \"\$TARGET_PATH/.git\" ]; then \ + "mkdir -p \"$DEPLOY_PATH\"; \ + if [ -d \"$DEPLOY_PATH/.git\" ]; then \ echo 'Pulling latest changes...'; \ - cd \"\$TARGET_PATH\" && git fetch --all && git reset --hard origin/${GITHUB_REF##*/}; \ + cd \"$DEPLOY_PATH\" && git fetch --all && git reset --hard origin/$BRANCH; \ else \ echo 'Cloning repo...'; \ - git clone -b ${GITHUB_REF##*/} https://github.com/mppnet/frontend.git \"\$TARGET_PATH\"; \ + git clone -b $BRANCH https://github.com/mppnet/frontend.git \"$DEPLOY_PATH\"; \ fi"