appleboy pls help

This commit is contained in:
Kim 2023-11-06 13:11:04 +01:00
parent bb49cda7ad
commit 56d2e9712a
1 changed files with 55 additions and 24 deletions

View File

@ -21,28 +21,59 @@ jobs:
- run: |
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build
- name: Configure SSH
run: |
mkdir -p /root/.ssh/
touch /root/.ssh/config
echo '$SSH_KEY' > /root/.ssh/id_rsa
chmod 700 /root/.ssh/id_rsa
- name: Copy Backend
uses: appleboy/scp-action@v0.1.4
with:
host: 91.92.154.141
username: ubuntu
key: ${{ secrets.STAGING_SSH_KEY }}
source: "${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/"
target: "staging:~/backend"
cat >> /root/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
IdentityFile /root/.ssh/id_rsa
StrictHostKeyChecking no
END
env:
SSH_USER: ubuntu
SSH_HOST: 91.92.154.141
SSS_KEY: ${{ secrets.STAGING_SSH_KEY }}
- run: sudo su
- run: scp -vo StrictHostKeyChecking=no -r ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ staging:~/backend
- run: scp -vo StrictHostKeyChecking=no -r ${{ gitea.workspace }}/typescript/frontend-marios2/* staging:~/frontend/
- run: ssh -vo StrictHostKeyChecking=no staging 'sudo systemctl restart backend'
- run: ssh -vo StrictHostKeyChecking=no staging 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/'
- run: ssh -vo StrictHostKeyChecking=no staging 'sudo npm install -g serve'
- run: echo " This job's status is ${{ job.status }}."
- name: Copy Frontend
uses: appleboy/scp-action@v0.1.4
with:
host: 91.92.154.141
username: ubuntu
key: ${{ secrets.STAGING_SSH_KEY }}
source: "${{ gitea.workspace }}/typescript/frontend-marios2/"
target: "staging:~/frontend"
- name: restart services
uses: appleboy/ssh-action@v0.1.4
with:
host: 91.92.154.141
username: ubuntu
key: ${{ secrets.STAGING_SSH_KEY }}
script: |
sudo systemctl restart backend
sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/
sudo npm install -g serve
- run: echo " This job's status is ${{ job.status }}."
# - name: Configure SSH
# run: |
# mkdir -p /root/.ssh/
# touch /root/.ssh/config
# echo '$SSH_KEY' > /root/.ssh/id_rsa
# chmod 700 /root/.ssh/id_rsa
#
# cat >> /root/.ssh/config <<END
# Host staging
# HostName $SSH_HOST
# User $SSH_USER
# IdentityFile /root/.ssh/id_rsa
# StrictHostKeyChecking no
# END
# env:
# SSH_USER: ubuntu
# SSH_HOST: 91.92.154.141
# SSS_KEY: ${{ secrets.STAGING_SSH_KEY }}
# - run: scp -vo StrictHostKeyChecking=no -r ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ staging:~/backend
# - run: scp -vo StrictHostKeyChecking=no -r ${{ gitea.workspace }}/typescript/frontend-marios2/* staging:~/frontend/
# - run: ssh -vo StrictHostKeyChecking=no staging 'sudo systemctl restart backend'
# - run: ssh -vo StrictHostKeyChecking=no staging 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/'
# - run: ssh -vo StrictHostKeyChecking=no staging 'sudo npm install -g serve'
# - run: echo " This job's status is ${{ job.status }}."