File tree Expand file tree Collapse file tree 3 files changed +31
-5
lines changed Expand file tree Collapse file tree 3 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,15 @@ Default: `.`
5050
5151The working directory where the zip or tar actually runs.
5252
53+ # ## `type`
54+ Default : ` zip`
55+
56+ Either `zip` or `tar`.
57+
58+ Defines if either a ZIP-file is created, or a tar archive (the latter gzipped).
59+
60+ On Windows platform 7zip is used to zip files as zip command is not available there.
61+
5362# ## `exclusions`
5463Default : none
5564
@@ -61,12 +70,14 @@ ZIP requires you to specify wildcards or full filenames.
6170
6271TAR allows you to specify only the filename, no matter if it's in a subdirectory.
6372
64- # ## `type `
65- Default : ` zip `
73+ # ## `recursive_exclusions `
74+ Default : none
6675
67- Either `zip` or `tar`.
76+ Alternative to `exclusions` that allows you to specify a list of [recursive wildcards](https://sevenzip.osdn.jp/chm/cmdline/switches/recurse.htm).
77+ Only applies to `type : zip` on Windows where 7zip is used.
6878
69- Defines if either a ZIP-file is created, or a tar archive (the latter gzipped).
79+ For example :
7080
71- On Windows platform 7zip is used to zip files as zip command is not available there.
81+ ```exclusions : *.txt``` will only exclude files ending with `.txt`
7282
83+ ```recursive_exclusions : *.txt``` will exclude files ending with `.txt` in any subdirectory.
Original file line number Diff line number Diff line change @@ -12,15 +12,23 @@ inputs:
1212 path :
1313 description : ' Base path for archive files'
1414 default : ' .'
15+ required : false
1516 directory :
1617 description : ' Working directory before zipping'
1718 default : ' .'
19+ required : false
1820 exclusions :
1921 description : ' List of excluded files / directories'
2022 default : ' '
23+ required : false
24+ recursive_exclusions :
25+ description : ' List of excluded files / directories with recursive wildcards (only applies on Windows with `zip` type)'
26+ default : ' '
27+ required : false
2128 type :
2229 description : ' Tool to use for archiving'
2330 default : ' zip'
31+ required : false
2432runs :
2533 using : composite
2634 steps :
3038 INPUT_PATH : ${{ inputs.path }}
3139 INPUT_DIRECTORY : ${{ inputs.directory }}
3240 INPUT_EXCLUSIONS : ${{ inputs.exclusions }}
41+ INPUT_RECURSIVE_EXCLUSIONS : ${{ inputs.recursive_exclusions }}
3342 INPUT_TYPE : ${{ inputs.type }}
3443 run : $GITHUB_ACTION_PATH/entrypoint.sh
3544
Original file line number Diff line number Diff line change 2626 EXCLUSIONS+=$EXCLUSION
2727 done
2828
29+ for EXCLUSION in $INPUT_RECURSIVE_EXCLUSIONS
30+ do
31+ EXCLUSIONS+=" -xr!"
32+ EXCLUSIONS+=$EXCLUSION
33+ done
34+
2935 7z a -tzip $INPUT_FILENAME $INPUT_PATH $EXCLUSIONS || { printf " \n⛔ Unable to create %s archive.\n" " $INPUT_TYPE " ; exit 1; }
3036 fi
3137 else
You can’t perform that action at this time.
0 commit comments