From 569c2316c20337ec3cc6f9a0e9b7518887ebbb26 Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Wed, 5 Jun 2024 18:02:38 -0500 Subject: [PATCH] Adding deploy steps --- .gitea/workflows/{build.yaml => ci.yaml} | 28 ++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) rename .gitea/workflows/{build.yaml => ci.yaml} (55%) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/ci.yaml similarity index 55% rename from .gitea/workflows/build.yaml rename to .gitea/workflows/ci.yaml index 65dab78..fa63e11 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/ci.yaml @@ -45,5 +45,29 @@ jobs: run: npm config set -- '//gitea.watsonlabs.net/api/packages/watsonb8/npm/:_authToken' "$NPM_TOKEN" - run: npm publish - # deploy: - # name: Deploy Package + deploy: + runs-on: internal + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up SSH key + run: | + env + mkdir -p ~/.ssh + echo "${{ secrets.HOMEBRIDGE_SSH_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -p 22 homebridge.me >> ~/.ssh/known_hosts + sudo apt-get install sshpass + + - name: Remove old Package + run: | + sshpass -p '${{ secrets.HOMEBRIDGE_PASSWORD }}' ssh -v -o StrictHostKeyChecking=no ${{ secrets.HOMEBRIDGE_USER }}@${{ secrets.HOMEBRIDGE_HOST }} <<'ENDSSH' + rm -r /home/$SSH_USER/.npm-global/lib/node_modules/@watsonb8/homebridge-hue-chase + ENDSSH + - name: Deploy + run: | + sshpass -p '${{ secrets.HOMEBRIDGE_PASSWORD }}' ssh -v -o StrictHostKeyChecking=no ${{ secrets.HOMEBRIDGE_USER }}@${{ secrets.HOMEBRIDGE_HOST }} <<'ENDSSH' + npm install -g @watsonb8/homebridge-hue-chase + ENDSSH +