added deploy step to workflow
Some checks failed
My Gatsby Deployment pipeline / build (push) Successful in 1m50s
My Gatsby Deployment pipeline / deploy (push) Failing after 12s

This commit is contained in:
2025-03-15 23:41:09 +01:00
parent 346e392c5b
commit a1118dd472

View File

@@ -51,3 +51,41 @@ jobs:
with:
name: gatsby-build
path: public/
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: gatsby-build
path: public
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Deploy to web server
env:
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
run: |
rsync -avz -e "ssh -p 2266" \
--exclude='mailadmin/' \
--exclude='postfixadmin/' \
--exclude='roundcube/' \
public/ \
$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
- name: Verify deployment
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
run: |
ssh $DEPLOY_USER@$DEPLOY_HOST "test -d $DEPLOY_PATH && echo 'Deployment successful' || (echo 'Deployment failed' && exit 1)"