sync packages thumbnails into production cdn

This commit is contained in:
neil 2022-10-29 10:31:10 +08:00
parent ccce94178f
commit fb788fbc4c
3 changed files with 48 additions and 44 deletions

View file

@ -2,7 +2,8 @@
# cmd: $ ./prepare-thumb-images.sh srcJson targetPath
# 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"
temp_packages="./src/data/temp.json"
cp $1 $temp_packages
@ -18,8 +19,8 @@ for row in $($packages | jq -r '.[] | @base64'); do
filename="${filename%.*}"
slug=$(_jq '.slug')
outputPath=$2/$(_jq '.slug').$extension
new_thumb_image_url="/Images/packages/$slug.$extension"
curl $dl_url -o $2/$slug.$extension
new_thumb_image_url="https://tea.xyz/Images/packages/$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)
echo $updated_packages > $temp_packages
echo "update $slug"
@ -28,3 +29,6 @@ done
# replace packages.json with the updated version with localized image links
mv $temp_packages $1
# upload thumb images to production cdn
aws s3 sync ./packages_thumbs_images s3://www.tea.xyz/Images/packages

View file

@ -92,49 +92,49 @@ jobs:
with:
cmd: '.github/build-package-pages.sh src/data/packages.json src/content/packages'
# - name: Download package thumbnail images
# uses: getneil/jq-action@v1
# with:
# cmd: '.github/prepare-thumb-images.sh src/data/packages.json ./src/static/Images/packages/'
- run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
- uses: teaxyz/setup@v0
with:
target: build
- name: Check for broken links
uses: lycheeverse/lychee-action@v1
with:
fail: true
args: --verbose --no-progress './public/**/*.md' './public/**/*.html'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: bahmutov/npm-install@v1
with:
working-directory: .cdk
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy to AWS
id: cdk_deploy
run: yarn deploy
working-directory: .cdk
- name: Seal Deployment
uses: bobheadxi/deployments@v1
if: always()
- name: Download and Upload package thumbnails from Airtable
uses: getneil/jq-action@v1
with:
step: finish
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ env.STAGE }}
env_url: ${{ steps.cdk_deploy.outputs.env_url }}
cmd: '.github/prepare-thumb-images.sh src/data/packages.json'
# - run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
# - uses: teaxyz/setup@v0
# with:
# target: build
# - name: Check for broken links
# uses: lycheeverse/lychee-action@v1
# with:
# fail: true
# args: --verbose --no-progress './public/**/*.md' './public/**/*.html'
# env:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - uses: actions/setup-node@v3
# with:
# node-version: 14
# - uses: bahmutov/npm-install@v1
# with:
# working-directory: .cdk
# - name: Deploy to AWS
# id: cdk_deploy
# run: yarn deploy
# working-directory: .cdk
# - name: Seal Deployment
# uses: bobheadxi/deployments@v1
# if: always()
# with:
# step: finish
# status: ${{ job.status }}
# deployment_id: ${{ steps.deployment.outputs.deployment_id }}
# env: ${{ env.STAGE }}
# env_url: ${{ steps.cdk_deploy.outputs.env_url }}

View file

@ -2,7 +2,7 @@
{
"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/",
"version": "2.5.1",
"installs": 3986221,