-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (63 loc) · 2.96 KB
/
catalog.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
name: Create catalog proxy
on:
workflow_dispatch:
inputs:
catalog:
type: string
description: Source remote catalog file
default: list
extra_addons:
type: string
description: extra addons list (foo:4.0.0,tar:5.0.0-M01 comma seperated)
jobs:
catalog-proxy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate catalog
run: |
rawURL="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_REF##*/}"
plfVersion=$(echo ${GITHUB_REF##*/} | grep -oP "^[0-9]+\.[0-9]+\.[0-9]+(-exo|-meed)?")
curl -fsSL http://storage.exoplatform.org/public/Addons/${{ inputs.catalog }}.json | jq ".[] | select(.compatibility==\"[${plfVersion}]\")" | jq -s > /tmp/filtredcatalog.json
echo ${{ inputs.extra_addons }} | tr ',' '\n' | while read _addon ; do
id=$(echo ${addon} | cut -d ':' -f1 )
version=$(echo ${addon} | cut -d ':' -f2 )
curl -fsSL http://storage.exoplatform.org/public/Addons/${{ inputs.catalog }}.json | jq ".[] | select((.id==\"${id}\") and (.version==\"${version}\"))" > /tmp/custcat.json
jq '. += $inputs' /tmp/filtredcatalog.json --slurpfile inputs /tmp/custcat.json | sponge /tmp/filtredcatalog.json
done
cp -f /tmp/filtredcatalog.json list.json
mkdir -p pkgs
for row in $(cat /tmp/filtredcatalog.json | jq -r '.[] | @base64'); do
_jq() {
echo ${row} | base64 --decode | jq -r ${1}
}
id=$(_jq '.id')
version=$(_jq '.version')
downloadUrl=$(_jq '.downloadUrl')
filename="${id}-${version}.zip"
rm "pkgs/${id}-${version}.zip" || true
wget $downloadUrl -O "pkgs/${id}-${version}.zip"
rawDownloadURL="${rawURL}/pkgs/${id}-${version}.zip"
sed -i "s|$downloadUrl|${rawDownloadURL}|g" list.json
done
rm -v /tmp/filtredcatalog.json
curl -fsSL http://patches.exoplatform.org/catalog.json | jq ".[] | select(.compatibility==\"[${plfVersion}]\")" | jq -s > /tmp/filtredcatalog.json
cp -f /tmp/filtredcatalog.json patch.json
mkdir -p patches
for row in $(cat /tmp/filtredcatalog.json | jq -r '.[] | @base64'); do
_jq() {
echo ${row} | base64 --decode | jq -r ${1}
}
id=$(_jq '.id')
version=$(_jq '.version')
downloadUrl=$(_jq '.downloadUrl')
filename="${id}-${version}.zip"
rm "patches/${id}-${version}.zip" || true
wget $downloadUrl -O "patches/${id}-${version}.zip"
rawDownloadURL="${rawURL}/patches/${id}-${version}.zip"
sed -i "s|$downloadUrl|${rawDownloadURL}|g" patch.json
done
git add .
git -c user.name="Patch Generator" -c user.email="[email protected]" commit -m 'Generate catalog'
git push origin HEAD