FTP-Deploy-Action icon indicating copy to clipboard operation
FTP-Deploy-Action copied to clipboard

Negated exclude glob pattern does not seem to work

Open jdiazgon55 opened this issue 4 years ago • 2 comments

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/[email protected]
        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/[email protected]
        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 avatar Nov 26 '21 15:11 jdiazgon55

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.

jdiazgon55 avatar Nov 26 '21 15:11 jdiazgon55

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

BenedictLang avatar Jan 30 '22 07:01 BenedictLang

Duplicate of #292

SamKirkland avatar Mar 16 '23 15:03 SamKirkland