Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep images folder between deploys #5

Closed
kosratdev opened this issue Jul 28, 2020 · 5 comments
Closed

Keep images folder between deploys #5

kosratdev opened this issue Jul 28, 2020 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested

Comments

@kosratdev
Copy link

I have images folder on my website which stores user's uploaded images so that I want to keep this folder between deploys to not be deleted with sync.
Is there a way to achieve that??

@Burnett01
Copy link
Owner

I have images folder on my website which stores user's uploaded images so that I want to keep this folder between deploys to not be deleted with sync.
Is there a way to achieve that??

Hello, sure thing! Simply use the --exclude switch or the --filter switch.

Here is an example (assuming your image folder is located at /var/www/images):

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: rsync deployments
      uses: burnett01/[email protected]
      with:
        switches: -avzr --delete --exclude="images"
        path: src/
        remote_path: /var/www/html/
        remote_host: ${{ secrets.DEPLOY_HOST }}
        remote_port: ${{ secrets.DEPLOY_PORT }}
        remote_user: ${{ secrets.DEPLOY_USER }}
        remote_key: ${{ secrets.DEPLOY_KEY }}

If your images folder is located at a deeper level and not at remote_path, simply adjust the path to your folder in the --exclude switch:

--exclude="public/images"

Greetings, Steve

@Burnett01 Burnett01 self-assigned this Jul 30, 2020
@Burnett01 Burnett01 added help wanted Extra attention is needed question Further information is requested labels Jul 30, 2020
@kosratdev
Copy link
Author

I have some default images on it so I have to include it and while developing maybe we will add some other default images too so that I want to merge the images folder but I don't want to merge other folders right now I'm using the following SWITCHES
-rltgoDzvO
It will merge all other folders but I want only to merge the images folder, not others.
is there any solution for my situation?

@Burnett01
Copy link
Owner

Burnett01 commented Aug 1, 2020

I have some default images on it so I have to include it and while developing maybe we will add some other default images too so that I want to merge the images folder but I don't want to merge other folders right now I'm using the following SWITCHES
-rltgoDzvO
It will merge all other folders but I want only to merge the images folder, not others.
is there any solution for my situation?

Yes you could use the --include switch to only have the images folder deployed by rsync.
Example: --include="*/images" --exclude="*"

If you wish to keep certain images (default images) but not all of them, you could combine --include and --exclude as shown above, or use a filter.

Example with --include/exclude:
--include="/images/" --include="/images/default.png" --exclude="*"

Example with --filter:
Create a filter.conf file in your .github folder (in your repo) with the following content:

+ /images/
+ /images/default.png
- *

Now you can use that filter with the --filter switch:
--filter="merge .github/filter.conf"

@Burnett01 Burnett01 added the documentation Improvements or additions to documentation label Aug 1, 2020
@Burnett01
Copy link
Owner

If you need further help, feel free to re-open this issue.

@Burnett01 Burnett01 pinned this issue Sep 29, 2021
@Sandra-headscape
Copy link

just in case anyone else has trouble trying to use something like --exclude={.git,.ddev} - the curly brace expansion only works on specific shells, so you're better off either using a file for exclusions or just --exclude=path for each one

thanks for a great action (:

Burnett01 pushed a commit that referenced this issue Jul 1, 2024
feat(deps): update alpine base image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants