Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax authored Sep 1, 2024
1 parent df3cd60 commit 2a404f1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Clear Remote Directory
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
rm -rf ${{ secrets.SERVER_PATH }}*
- name: FTP Deployer
uses: sand4rt/[email protected]
with:
Expand All @@ -21,3 +32,24 @@ jobs:
include: '[ "*", "**/*" ]'
exclude: '["node_modules/**", ".github/**", ".git/**", "*.env"]'
pasive: true

- name: Check if the directory is empty
id: check_dir
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
if [ -z "$(ls -A ${{ secrets.SERVER_PATH }})" ]; then
echo "DIRECTORY_EMPTY=true" >> $GITHUB_ENV
else
echo "DIRECTORY_EMPTY=false" >> $GITHUB_ENV
fi
- name: Run additional commands if the directory is not empty
if: env.DIRECTORY_EMPTY == 'false'
run: |
npm install
npm run build

0 comments on commit 2a404f1

Please sign in to comment.