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

Negated exclude glob pattern does not seem to work #247

Closed
jdiazgon55 opened this issue Nov 26, 2021 · 3 comments
Closed

Negated exclude glob pattern does not seem to work #247

jdiazgon55 opened this issue Nov 26, 2021 · 3 comments

Comments

@jdiazgon55
Copy link

Bug Description
When using a negated glob pattern (i.e. !main.*), exclude does not seem to parse it correctly. I tested the glob pattern and I think my syntax is correct:

image

I want to exclude everything but main.533533353535.js. The other way around is:

image

My Action Config

on: push
name: Publish Website
jobs:
  web-deploy:
      - name: Desplegar front a produccion (NEXO ERP) 
        uses: SamKirkland/FTP-Deploy-Action@4.2.0
        with: 
          server: xxxxxx
          username: xxxxx
          password: ${{ secrets.ftp_password_prod }}
          local-dir: ./dist/prod-nexogeo-front/
          server-dir: pruebas/
          dry-run: true
          exclude: |
            !main.*

My Action Log

➕ Upload: index.html
➕ Upload: main.7a3ad33cea4274fddadd.js
➕ Upload: polyfills.70ffb02a82cc06d3b0cb.js
➕ Upload: runtime.7b63b9fd40098a2e8207.js
➕ Upload: styles.f9b4475c7347b120c30f.css

As you can see, not only my file main.7a3ad33cea4274fddadd.js. has been uploaded, but also the other ones.

Using the non-negated version:

on: push
name: Publish Website
jobs:
  web-deploy:
      - name: Desplegar front a produccion (NEXO ERP) 
        uses: SamKirkland/FTP-Deploy-Action@4.2.0
        with: 
          server: xxxxxx
          username: xxxxx
          password: ${{ secrets.ftp_password_prod }}
          local-dir: ./dist/prod-nexogeo-front/
          server-dir: pruebas/
          dry-run: true
          exclude: |
            main.*

My Action Log

➕ Upload: index.html
➕ Upload: polyfills.70ffb02a82cc06d3b0cb.js
➕ Upload: runtime.7b63b9fd40098a2e8207.js
➕ Upload: styles.f9b4475c7347b120c30f.css

My file main.7a3ad33cea4274fddadd.js. has been correctly excluded.

What am I trying to achieve? Actually when uploading my files, every already existing file is getting deleted. I just want to upload the files I negate on exclude so that it does not remove other previous files with different names.

@jdiazgon55
Copy link
Author

jdiazgon55 commented Nov 26, 2021

What am I trying to achieve? Actually when uploading my files, every already existing file is getting deleted. I just want to upload the files I negate on exclude so that it does not remove other previous files with different names.

Small update: It seems that an old .ftp-deploy-sync-state.json was forcing the removal of my files. I deleted it and now it works as I expected.

However, the issue I posted is still relevant. It would be nice to have an include option or the possibility to have negated glob patterns.

@BenedictLang
Copy link

BenedictLang commented Jan 30, 2022

However, the issue I posted is still relevant. It would be nice to have an include option or the possibility to have negated glob patterns.

I need to agree, I have a dashboard managing parts of subfolders in the directory where i want to upload my files. I would like to be able to just delete the files named in my .ftp-deploy-sync-state.json and replace them with the newest content of my build folder in the repo or just exclude folders from deleting or delete all index.contentHash.js files which ar older than the new ones that just differ in the content hash.

ftp-destination
|--> index.aui3h2308.html
|--> index.sijo4997.js
|--> styles.souh3876.css
|--> ... more content i wont know the names of, only the deploy cache json
--------------let the folders as they are on deploy----------
|--> project1 folder/...
|--> project2 folder/...

I dont want the script to not delete only excluded files/folders as I dont know what further subfolders i will upload, that will be deleted automatically on deploy.

Or is there an easy solution I do not see? I might have to turn off content hashes in my bundler, but i would rather prefer to keep them to prevent browser caching errors

@SamKirkland
Copy link
Owner

Duplicate of #292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants