From fb788fbc4c5a7d866dc994e0b43cd5040ce81b68 Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 29 Oct 2022 10:31:10 +0800 Subject: [PATCH] sync packages thumbnails into production cdn --- .github/prepare-thumb-images.sh | 12 +++-- .github/workflows/staging.yml | 78 ++++++++++++++++----------------- src/data/packages.json | 2 +- 3 files changed, 48 insertions(+), 44 deletions(-) diff --git a/.github/prepare-thumb-images.sh b/.github/prepare-thumb-images.sh index c4d2c9f..4a2b9f7 100755 --- a/.github/prepare-thumb-images.sh +++ b/.github/prepare-thumb-images.sh @@ -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" @@ -27,4 +28,7 @@ for row in $($packages | jq -r '.[] | @base64'); do done # replace packages.json with the updated version with localized image links -mv $temp_packages $1 \ No newline at end of file +mv $temp_packages $1 + +# upload thumb images to production cdn +aws s3 sync ./packages_thumbs_images s3://www.tea.xyz/Images/packages \ No newline at end of file diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 5936fe4..ff5b9df 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -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 }} diff --git a/src/data/packages.json b/src/data/packages.json index 6549ad0..4ad471e 100644 --- a/src/data/packages.json +++ b/src/data/packages.json @@ -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,