mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-24 00:20:24 +00:00
optimize media yml
This commit is contained in:
parent
d939d4ed4f
commit
814c80eff8
7 changed files with 104 additions and 3 deletions
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
|
@ -69,6 +69,8 @@ jobs:
|
|||
echo "DIRECTORY=docker/$APP" >> $GITHUB_ENV
|
||||
echo "README=docker/$APP/README.md" >> $GITHUB_ENV
|
||||
|
||||
|
||||
|
||||
- name: Build & push Docker image
|
||||
uses: mr-smithers-excellent/docker-build-push@v6
|
||||
with:
|
||||
|
|
76
.github/workflows/media.yml
vendored
Normal file
76
.github/workflows/media.yml
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
name: Buidl media for apphub image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
Build_New_Version_For_Release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ACCESS_TOKEN: ${{ secrets.CONTENTFUL_GRAPHQLTOKEN }}
|
||||
LOCALES: "en-US,zh-CN"
|
||||
DATA_DIR: "json"
|
||||
APPSTORE_LOGO_DIR: "logos"
|
||||
SCREENSHOT_DIR: "screenshots"
|
||||
LIMIT: 100
|
||||
CI: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install GNU Parallel
|
||||
run: sudo apt-get install -y parallel
|
||||
|
||||
- name: Fetch catalog data from contentful graphql
|
||||
run: |
|
||||
mkdir -p $DATA_DIR
|
||||
IFS=',' read -ra LOCALE_ARRAY <<< "$LOCALES"
|
||||
for LOCALE in "${LOCALE_ARRAY[@]}"; do
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||
-d '{"query":"query($locale: String){catalog(id: \"2Yp0TY3kBHgG6VDjsHZNpK\",locale:$locale) {linkedFrom(allowedLocales:[\"en-US\"]) {catalogCollection(limit:20) {items {key position title linkedFrom(allowedLocales:[\"en-US\"]) {catalogCollection(limit:20) {items {key title position}}}}}}}}","variables":{"locale":"'$LOCALE'"}}' \
|
||||
https://graphql.contentful.com/content/v1/spaces/ffrhttfighww | \
|
||||
jq '.data.catalog.linkedFrom.catalogCollection.items' > $DATA_DIR/catalog_${LOCALE:0:2}.json
|
||||
done
|
||||
|
||||
- name: Fetch product data json and download screenshots
|
||||
run: |
|
||||
mkdir -p $SCREENSHOT_DIR && IFS=',' read -ra LOCALE_ARRAY <<< "$LOCALES" && for LOCALE in "${LOCALE_ARRAY[@]}"; do
|
||||
SKIP=0
|
||||
TOTAL=0
|
||||
ITEMS=()
|
||||
while [ $SKIP -le $TOTAL ]; do
|
||||
RESPONSE=$(curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||
-d '{"query":"query($locale: String,$skip: Int){productCollection(locale:$locale,where:{appStore:true,production:true},limit: '$LIMIT', skip: $skip) {total items {sys {id} key hot trademark summary overview websiteurl description screenshots distribution vcpu memory storage logo {imageurl} catalogCollection(limit:15) {items {key title catalogCollection(limit:5){items{key title}}}}}}}", "variables":{"locale":"'$LOCALE'", "skip":'$SKIP'}}' \
|
||||
https://graphql.contentful.com/content/v1/spaces/ffrhttfighww)
|
||||
ITEMS+=($(echo $RESPONSE | jq '.data.productCollection.items[]'))
|
||||
TOTAL=$(echo $RESPONSE | jq '.data.productCollection.total')
|
||||
SKIP=$((SKIP + LIMIT))
|
||||
done
|
||||
echo ${ITEMS[@]} | jq -r '.screenshots[]?.value' | sed 's/"//g' | parallel -j 10 "wget -t 0 -N {} -P $SCREENSHOT_DIR/${LOCALE:0:2} || echo {} >> $SCREENSHOT_DIR/Error.log"
|
||||
echo ${ITEMS[@]} | jq -s '.' > $DATA_DIR/product_${LOCALE:0:2}.json
|
||||
done
|
||||
|
||||
- name: Install ossutil
|
||||
run: |
|
||||
wget http://gosspublic.alicdn.com/ossutil/1.7.6/ossutil64
|
||||
chmod 755 ossutil64
|
||||
- name: Configure ossutil
|
||||
run: ./ossutil64 config -e ${{ secrets.OSS_ENDPOINT }} -i ${{ secrets.OSS_ACCESS_KEY_ID }} -k ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||
|
||||
- name: Download logos from oss
|
||||
run: ./ossutil64 cp oss://libs-websoft9-com/Websoft9/logo/product/ $APPSTORE_LOGO_DIR -r --update
|
||||
|
||||
- name: Create Zip Archive
|
||||
run: |
|
||||
rsync -av json logos screenshots docs media
|
||||
zip -r media.zip media/
|
||||
|
||||
- name: Upload media.zip to artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: media
|
||||
path: media.zip
|
3
build/README.md
Normal file
3
build/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Build
|
||||
|
||||
Build scripts for DevOps
|
|
@ -15,10 +15,10 @@ ENV source_github_pages="https://websoft9.github.io/websoft9"
|
|||
|
||||
RUN apt update && apt install -y --no-install-recommends curl git jq cron iproute2 supervisor rsync wget unzip zip && \
|
||||
# Prepare source files
|
||||
wget $docker_library_repo/archive/refs/tags/$LIBRARY_VERSION.zip -O ./library.zip && \
|
||||
unzip library.zip && \
|
||||
mv docker-library-* w9library && \
|
||||
git clone --depth=1 $docker_library
|
||||
mv docker-library w9library && \
|
||||
rm -rf w9library/.github && \
|
||||
|
||||
wget $media_repo/archive/refs/tags/$MEDIA_VERSION.zip -O ./media.zip && \
|
||||
unzip media.zip && \
|
||||
mv media-* w9media && \
|
||||
|
|
3
media/README.md
Normal file
3
media/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# media
|
||||
|
||||
Wesoft9 application Logos, data and Screen shoot
|
13
media/media.json
Normal file
13
media/media.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"Plugin Name": "Media",
|
||||
"Repository": "https://github.com/Websoft9/plugin-media",
|
||||
"Update URI": "https://example.com/my-plugin/",
|
||||
"Description": "Wesoft9 application Logos, data and Screen shoot.",
|
||||
"Version": "0.0.7",
|
||||
"Requires at most": "1.9.0",
|
||||
"Requires at least": "0.0.2",
|
||||
"Author": "Websoft9 Inc",
|
||||
"Author URI": "https://www.websoft9.com/",
|
||||
"License": "GPL v2 or later",
|
||||
"License URI": "https://www.gnu.org/licenses/gpl-2.0.html"
|
||||
}
|
|
@ -9,6 +9,10 @@
|
|||
"settings": "0.0.8",
|
||||
"navigator": "0.5.10"
|
||||
},
|
||||
"data": {
|
||||
"media": "0.0.7",
|
||||
"library": "0.5.19-rc1"
|
||||
},
|
||||
"OS": {
|
||||
"Fedora": [
|
||||
"38",
|
||||
|
|
Loading…
Reference in a new issue