-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (63 loc) · 2.17 KB
/
Copy pathmanually-pack-themes.yml
File metadata and controls
77 lines (63 loc) · 2.17 KB
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
70
71
72
73
74
75
76
77
name: Package All Themes (Manual)
on:
workflow_dispatch:
jobs:
package-themes:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install 7-Zip
run: |
sudo apt-get update
sudo apt-get install -y p7zip-full
- name: Prepare PackedThemes Directory
run: |
mkdir -p PackedThemes
- name: Package All Themes
run: |
# Find all theme folders in the Themes directory
cd Themes
FOLDERS=$(find . -maxdepth 1 -type d ! -name ".*" ! -path "." | sed 's|^./||')
echo "Folders to process:"
printf '%s\n' "$FOLDERS"
# Store the absolute path to the workspace
WORKSPACE="$PWD/.."
# Process each theme folder
printf '%s\n' "$FOLDERS" | while IFS= read -r folder; do
if [ -d "$folder" ]; then
echo "Packaging $folder..."
# Remove existing archive if it exists
rm -f "${WORKSPACE}/PackedThemes/${folder}.7z"
# Create temporary directory structure
cd "$WORKSPACE"
mkdir -p "temp/mnt/SDCARD/Themes"
cp -r "Themes/$folder" "temp/mnt/SDCARD/Themes/"
# Create fresh 7z archive — cd into temp so paths start at mnt/SDCARD/
(cd temp && 7z a -r "${WORKSPACE}/PackedThemes/${folder}.7z" mnt)
# Cleanup
rm -rf temp
cd Themes
fi
done
- name: Upload to Release
env:
GH_TOKEN: ${{ github.token }}
run: |
normalize_name() {
echo "$1" | sed "s/ /_/g; s/'//g; s/!//g"
}
for f in PackedThemes/*.7z; do
[ -f "$f" ] || continue
base="$(basename "$f")"
normalized="$(normalize_name "$base")"
if [ "$base" != "$normalized" ]; then
cp "$f" "PackedThemes/$normalized"
gh release upload 1 "PackedThemes/$normalized" --clobber
else
gh release upload 1 "$f" --clobber
fi
done