Merge pull request #150 from teaxyz/bugfix/package-thumbnail-cdn

package thumbnail should come from cdn
This commit is contained in:
Neil 2022-10-29 11:07:48 +08:00 committed by GitHub
commit 8a1c202c03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 8 deletions

View file

@ -2,7 +2,8 @@
# cmd: $ ./prepare-thumb-images.sh srcJson targetPath # cmd: $ ./prepare-thumb-images.sh srcJson targetPath
# sample: $ .github/prepare-thumb-images.sh src/data/packages.json src/static/Images/packages/ # sample: $ .github/prepare-thumb-images.sh src/data/packages.json src/static/Images/packages/
mkdir -p $2 # create packages folder: where airtable images will be DLd
mkdir -p ./packages_thumbs_images
packages="cat $1" packages="cat $1"
temp_packages="./src/data/temp.json" temp_packages="./src/data/temp.json"
cp $1 $temp_packages cp $1 $temp_packages
@ -18,8 +19,8 @@ for row in $($packages | jq -r '.[] | @base64'); do
filename="${filename%.*}" filename="${filename%.*}"
slug=$(_jq '.slug') slug=$(_jq '.slug')
outputPath=$2/$(_jq '.slug').$extension outputPath=$2/$(_jq '.slug').$extension
new_thumb_image_url="/Images/packages/$slug.$extension" new_thumb_image_url="https://tea.xyz/Images/packages/$slug.$extension"
curl $dl_url -o $2/$slug.$extension curl $dl_url -o ./packages_thumbs_images/$slug.$extension
updated_packages=$(jq '(.[] | select(.slug == "'$slug'") | .thumb_image_url) |= "'$new_thumb_image_url'"' ./src/data/temp.json) updated_packages=$(jq '(.[] | select(.slug == "'$slug'") | .thumb_image_url) |= "'$new_thumb_image_url'"' ./src/data/temp.json)
echo $updated_packages > $temp_packages echo $updated_packages > $temp_packages
echo "update $slug" echo "update $slug"

View file

@ -39,6 +39,21 @@ jobs:
with: with:
cmd: '.github/build-package-pages.sh src/data/packages.json src/content/packages' cmd: '.github/build-package-pages.sh src/data/packages.json src/content/packages'
- name: Download package thumbnails from Airtable
uses: getneil/jq-action@v1
with:
cmd: '.github/prepare-thumb-images.sh src/data/packages.json'
- name: Upload package thumbnails to AWS S3
uses: jakejarvis/s3-sync-action@master
env:
AWS_S3_BUCKET: www.tea.xyz
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: 'packages_thumbs_images'
DEST_DIR: 'Images/packages'
- run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }} - run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
- uses: teaxyz/setup@v0 - uses: teaxyz/setup@v0
with: with:
@ -71,6 +86,7 @@ jobs:
--exclude 'pour.sh' \ --exclude 'pour.sh' \
--exclude 'tea.white-paper*.pdf' \ --exclude 'tea.white-paper*.pdf' \
--exclude '*.md' \ --exclude '*.md' \
--exclude 'public/Images/packages/*' \
--delete --delete
#TODO create a github-action that can be used to parse the #TODO create a github-action that can be used to parse the

View file

@ -92,10 +92,20 @@ jobs:
with: with:
cmd: '.github/build-package-pages.sh src/data/packages.json src/content/packages' cmd: '.github/build-package-pages.sh src/data/packages.json src/content/packages'
# - name: Download package thumbnail images - name: Download package thumbnails from Airtable
# uses: getneil/jq-action@v1 uses: getneil/jq-action@v1
# with: with:
# cmd: '.github/prepare-thumb-images.sh src/data/packages.json ./src/static/Images/packages/' cmd: '.github/prepare-thumb-images.sh src/data/packages.json'
- name: Upload package thumbnails to AWS S3
uses: jakejarvis/s3-sync-action@master
env:
AWS_S3_BUCKET: www.tea.xyz
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: 'packages_thumbs_images'
DEST_DIR: 'Images/packages'
- run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }} - run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}

View file

@ -2,7 +2,7 @@
{ {
"name": "mpdecimal", "name": "mpdecimal",
"full_name": "mpdecimal", "full_name": "mpdecimal",
"desc": "Library for decimal floating point arithmetic", "desc": "Library for decimal floating point arithmetics",
"homepage": "https://www.bytereef.org/mpdecimal/", "homepage": "https://www.bytereef.org/mpdecimal/",
"version": "2.5.1", "version": "2.5.1",
"installs": 3986221, "installs": 3986221,