-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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 |