-
Notifications
You must be signed in to change notification settings - Fork 3
209 lines (198 loc) · 10.5 KB
/
gen_thirdparty_meta.yaml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: ♻️ Generate ThirdParty Metadata ♻️
on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *" #UTC 03:00 AM --> 08:45 AM NPT @everyday
env:
RCLONE_CF_R2_PUB: "${{ secrets.RCLONE_CF_R2_PUB }}"
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 200
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Install Addons
run: |
#presets
set +x ; set +e
#-------------#
bash <(curl -qfsSL "https://pub.ajam.dev/repos/Azathothas/Arsenal/misc/Linux/install_dev_tools.sh")
continue-on-error: true
- name: Setup Env
run: |
#presets
set +x ; set +e
#-------------#
#tmp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
#GH Dirs
mkdir -pv "${GITHUB_WORKSPACE}/main/aarch64-Linux"
mkdir -pv "${GITHUB_WORKSPACE}/main/x86_64-Linux"
mkdir -pv "${GITHUB_WORKSPACE}/main/metadata"
#Setup Flatpak
sudo apt update -y -qq
sudo apt install flatpak -y
sudo usermod -aG "_flatpak" "runner"
#-------------#
##User-Agent
USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}"
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Generate Alpine & Brew
run: |
#Presets
set +x ; set +e
#--------------#
#Generate Alpine Data
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/fetch_alpine.sh")
dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_alpine.sh"
chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_alpine.sh"
bash "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_alpine.sh" &
#Generate HomeBrew Data
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/fetch_homebrew.sh")
dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_homebrew.sh"
chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_homebrew.sh"
bash "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_homebrew.sh" &
wait ; echo
continue-on-error: true
- name: Generate ArchLinux
run: |
#Presets
set +x ; set +e
#--------------#
#Docker
pushd "$(mktemp -d)" >/dev/null 2>&1
chmod +xwr "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_archlinux.sh"
docker run --privileged --name "archlinux" -u "runner" -v "${GITHUB_WORKSPACE}:/workspace" "azathothas/archlinux-builder:latest" bash -l -c '"/workspace/main/scripts/metadata/fetch_archlinux.sh"'
docker cp "archlinux:/tmp/ARCHLINUX.json" "$(pwd)/ARCHLINUX.json"
cp -fv "./ARCHLINUX.json" "${SYSTMP}/ARCHLINUX.json"
popd >/dev/null 2>&1
continue-on-error: true
- name: Generate Debian
run: |
#Presets
set +x ; set +e
#--------------#
#Generate Debian Data
##bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/fetch_debian.sh")
#dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_debian.sh"
#chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_debian.sh"
#bash "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_debian.sh"
#Docker
pushd "$(mktemp -d)" >/dev/null 2>&1
chmod +xwr "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_debian.sh"
docker run --privileged --name "debian" -v "${GITHUB_WORKSPACE}:/workspace" "debian:latest" bash -l -c '"/workspace/main/scripts/metadata/fetch_debian.sh"'
docker cp "debian:/tmp/DEBIAN.json" "$(pwd)/DEBIAN.json"
cp -fv "./DEBIAN.json" "${SYSTMP}/DEBIAN.json"
popd >/dev/null 2>&1
continue-on-error: true
- name: Generate FlatPak & NixPkgs & PkgSrc
run: |
#Presets
set +x ; set +e
#--------------#
#Generate Flatpak Data
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/fetch_flatpak.sh")
dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_flatpak.sh"
chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_flatpak.sh"
bash "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_flatpak.sh" &
#Generate NixPkgs Data
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/fetch_nixpkgs.sh")
dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_nixpkgs.sh"
chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_nixpkgs.sh"
bash "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_nixpkgs.sh" &
#Generate PkgSrc Data
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/fetch_pkgsrc.sh")
dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_pkgsrc.sh"
chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_pkgsrc.sh"
bash "${GITHUB_WORKSPACE}/main/scripts/metadata/fetch_pkgsrc.sh" &
wait ; echo
continue-on-error: true
- name: Copy (Repo)
run: |
#Presets
set +x ; set +e
#--------------#
if [[ -s "${SYSTMP}/ALPINE.json" ]] && [[ $(stat -c%s "${SYSTMP}/ALPINE.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/ALPINE.json" "${GITHUB_WORKSPACE}/main/metadata/ALPINE.json"
fi
if [[ -s "${SYSTMP}/ARCHLINUX.json" ]] && [[ $(stat -c%s "${SYSTMP}/ARCHLINUX.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/ARCHLINUX.json" "${GITHUB_WORKSPACE}/main/metadata/ARCHLINUX.json"
fi
if [[ -s "${SYSTMP}/BREW_FORMULA.json" ]] && [[ $(stat -c%s "${SYSTMP}/BREW_FORMULA.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/BREW_FORMULA.json" "${GITHUB_WORKSPACE}/main/metadata/BREW_FORMULA.json"
fi
if [[ -s "${SYSTMP}/BREW_CASK.json" ]] && [[ $(stat -c%s "${SYSTMP}/BREW_CASK.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/BREW_CASK.json" "${GITHUB_WORKSPACE}/main/metadata/BREW_CASK.json"
fi
if [[ -s "${SYSTMP}/DEBIAN.json" ]] && [[ $(stat -c%s "${SYSTMP}/DEBIAN.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/DEBIAN.json" "${GITHUB_WORKSPACE}/main/metadata/DEBIAN.json"
fi
if [[ -s "${SYSTMP}/FLATPAK_APPSTREAM.xml" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_APPSTREAM.xml") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_APPSTREAM.xml" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_APPSTREAM.xml"
fi
if [[ -s "${SYSTMP}/FLATPAK_APPS_INFO.txt" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_APPS_INFO.txt") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_APPS_INFO.txt" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_APPS_INFO.txt"
fi
if [[ -s "${SYSTMP}/FLATPAK_APPS_INFO.txt" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_APPS_INFO.txt") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_APPS_INFO.txt" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_APPS_INFO.txt"
fi
if [[ -s "${SYSTMP}/FLATPAK_APPS_INFO.json" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_APPS_INFO.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_APPS_INFO.json" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_APPS_INFO.json"
fi
if [[ -s "${SYSTMP}/FLATPAK_APP_IDS.txt" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_APP_IDS.txt") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_APP_IDS.txt" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_APP_IDS.txt"
fi
if [[ -s "${SYSTMP}/FLATPAK_POPULAR.json" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_POPULAR.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_POPULAR.json" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_POPULAR.json"
fi
if [[ -s "${SYSTMP}/FLATPAK_TRENDING.json" ]] && [[ $(stat -c%s "${SYSTMP}/FLATPAK_TRENDING.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/FLATPAK_TRENDING.json" "${GITHUB_WORKSPACE}/main/metadata/FLATPAK_TRENDING.json"
fi
if [[ -s "${SYSTMP}/NIXPKGS.json" ]] && [[ $(stat -c%s "${SYSTMP}/NIXPKGS.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/NIXPKGS.json" "${GITHUB_WORKSPACE}/main/metadata/NIXPKGS.json"
fi
if [[ -s "${SYSTMP}/PKGSRC.json" ]] && [[ $(stat -c%s "${SYSTMP}/PKGSRC.json") -gt 1000 ]]; then
cp -fv "${SYSTMP}/PKGSRC.json" "${GITHUB_WORKSPACE}/main/metadata/PKGSRC.json"
fi
continue-on-error: true
- name: Get DateTime & Purge files (=> 95 MB)
run: |
#Presets
set +x ; set +e
#--------------#
UTC_TIME="$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')"
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
#Sync
cd "${GITHUB_WORKSPACE}/main"
git pull origin main --no-edit 2>/dev/null
#Purge
find "${GITHUB_WORKSPACE}/main" -path "${GITHUB_WORKSPACE}/main/.git" -prune -o -type f -size +95M -exec rm -rvf "{}" + 2>/dev/null
continue-on-error: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
commit_user_name: Azathothas
commit_user_email: [email protected]
commit_message: "✅ Updated (ThirdParty Metadata) 🛍️"
#push_options: '--force'
continue-on-error: true
- name: Upload (R2)
run: |
# Presets
set +x ; set +e
#--------------#
#touch "${HOME}/.rclone.conf"
echo "${{ secrets.RCLONE_CF_R2_PUB }}" > "${HOME}/.rclone.conf"
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/metadata/upload_to_r2.sh")
dos2unix --quiet "${GITHUB_WORKSPACE}/main/scripts/metadata/upload_to_r2.sh"
chmod +x "${GITHUB_WORKSPACE}/main/scripts/metadata/upload_to_r2.sh"
bash "${GITHUB_WORKSPACE}/main/scripts/metadata/upload_to_r2.sh"
continue-on-error: true