Compare commits

..

No commits in common. "d7920883cea02adb6d785325f1e27a935ee3d409" and "795886a30bd391a1394efa22c7cce83bb72a0fae" have entirely different histories.

View File

@ -7,11 +7,9 @@ jobs:
container: container:
image: alpine image: alpine
steps: steps:
- name: Install packages - name: Install git and openssh
run: | run: |
apk add --no-cache git openssh-client nodejs apk add --no-cache git openssh-client
- name: Checkout code
uses: actions/checkout@v3
- name: Setup SSH - name: Setup SSH
env: env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
@ -22,11 +20,18 @@ jobs:
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H $HOST1 >> ~/.ssh/known_hosts ssh-keyscan -H $HOST1 >> ~/.ssh/known_hosts
- name: Deploy to host - name: Deploy to first host
env: env:
HOST1: ${{ secrets.HOST1 }} HOST1: ${{ secrets.HOST1 }}
USER: ${{ secrets.USER }} USER: ${{ secrets.USER }}
run: | run: |
ssh $USER@$HOST1 'rm -rf /var/www/elia.network/html/*' ssh $USER@$HOST1 'rm -rf /var/www/elia.network/html/*'
scp -r . $USER@$HOST1:/var/www/elia.network/html chmod -R 777 .
scp -r . $USER@$HOST1:/var/www/elia.network/html/
ssh $USER@$HOST1 'rm -r /var/www/elia.network/html/.git*' ssh $USER@$HOST1 'rm -r /var/www/elia.network/html/.git*'
- name: Reload Nginx
env:
HOST1: ${{ secrets.HOST1 }}
USER: ${{ secrets.USER }}
run: |
ssh $USER@$HOST1 'sudo systemctl reload nginx'