Skip to content

Web-deploy keeps deleting manually created files and folders #15

@sammyskills

Description

@sammyskills

Bug Description
Whenever I run the web-deploy action in my server, all files and folders that does not exist in the git repo are automatically deleted from the server.

For example, I have a file .env and this file is not included in the github repo, but whenever I run the deploy script, it is automatically deleted from the server. Same goes for folders which are created manually in the server.

My Action Config

on:
    push:
        branches:
            - production
name: 🚀 Deploy files to the production server on push to production branch
jobs:
    deploy:
        name: 🎉 Deploy files
        runs-on: ubuntu-latest
        steps:
            - name: 🚚 Get latest code
              uses: actions/checkout@v4

            - name: Setup PHP 🐘
              uses: shivammathur/setup-php@v2
              with:
                php-version: 8.2

            - name: Cache Composer Packages 📦
              id: composer-cache
              uses: actions/cache@v3
              with:
                path: vendor
                key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
                restore-keys: |
                    ${{ runner.os }}-php-

            - name: Install Dependencies 👨‍👩‍👧‍👦
              run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

            - name: 📂 Sync files
              uses: SamKirkland/web-deploy@v1
              with:
                target-server: example.com
                remote-user: ${{ secrets.do_sftp_username }}
                private-ssh-key: ${{ secrets.do_application_ssh_key }}
                destination-path: ~/public_html/
                source-path: ./
                ssh-port: 22
                rsync-options: --archive --verbose --compress --delete-after --human-readable --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore --exclude "misc/" --exclude "src/" --exclude "*.txt"

What could be the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions