refactor(deploy.yml): improve SSH deployment process
Some checks failed
Deploy to production / deploy (push) Has been cancelled
Some checks failed
Deploy to production / deploy (push) Has been cancelled
- Added steps to prepare SSH keys and known hosts for secure connections. - Implemented a test for the SSH connection to ensure successful deployment. - Updated the deployment step to use SSH for executing the deployment script on the production server.
This commit is contained in:
@@ -10,12 +10,23 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Run deployment on production server
|
- name: Prepare SSH
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
run: |
|
||||||
with:
|
mkdir -p ~/.ssh
|
||||||
host: ${{ secrets.PROD_HOST }}
|
printf "%s" "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_ed25519
|
||||||
username: ${{ secrets.PROD_USER }}
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
key: ${{ secrets.PROD_SSH_KEY }}
|
ssh-keyscan -p "${{ secrets.PROD_PORT }}" "${{ secrets.PROD_HOST }}" >> ~/.ssh/known_hosts
|
||||||
port: ${{ secrets.PROD_PORT }}
|
|
||||||
script: |
|
- name: Test SSH connection
|
||||||
/home/tsschulz/actualize-yourpart.sh
|
run: |
|
||||||
|
ssh -i ~/.ssh/id_ed25519 \
|
||||||
|
-p "${{ secrets.PROD_PORT }}" \
|
||||||
|
"${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}" \
|
||||||
|
"echo SSH OK"
|
||||||
|
|
||||||
|
- name: Run deployment script
|
||||||
|
run: |
|
||||||
|
ssh -i ~/.ssh/id_ed25519 \
|
||||||
|
-p "${{ secrets.PROD_PORT }}" \
|
||||||
|
"${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}" \
|
||||||
|
"/home/tsschulz/actualize-yourpart.sh"
|
||||||
Reference in New Issue
Block a user