-
Notifications
You must be signed in to change notification settings - Fork 110
69 lines (58 loc) · 2.17 KB
/
package-applications.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Package Applications
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
jobs:
package-applications:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Package applications
run: |
# Find all directories at the root level
for folder in $(find . -mindepth 1 -maxdepth 1 -type d -exec basename {} \;); do
echo "Processing folder: $folder"
# Check if the folder is a Java or Python project
if find $folder -type f \( -name "*.java" -o -name "*.py" \) | grep -q .; then
echo "Skipping $folder as it is a Java or Python project."
continue
fi
# Check for changes or if the zip file does not already exist
if git diff --quiet HEAD^ -- $folder && [ -f "$folder/application.zip" ]; then
echo "No changes and zip already exists for $folder. Skipping."
continue
fi
echo "Creating zip for $folder"
# Check if .vespaignore exists and create exclude list
exclude_args=""
if [ -f "$folder/.vespaignore" ]; then
while IFS= read -r line || [ -n "$line" ]; do
exclude_args="$exclude_args --exclude=$line"
done < "$folder/.vespaignore"
fi
# Create the zip inside the folder
(cd $folder && zip -r application.zip . $exclude_args)
done
- name: Upload zip files
uses: actions/upload-artifact@v2
with:
name: applications
path: "*.zip"
# Configure Git
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Commit Changes
run: |
git add .
git commit -m "Create application.zip for new or editted folders" || echo "No application.zips created"
- name: Push Changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}