diff --git a/.github/prepare-thumb-images.sh b/.github/prepare-thumb-images.sh index c4d2c9f..1a8d9c8 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" diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 013357c..06f9567 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -39,6 +39,21 @@ jobs: with: 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 }} - uses: teaxyz/setup@v0 with: @@ -71,6 +86,7 @@ jobs: --exclude 'pour.sh' \ --exclude 'tea.white-paper*.pdf' \ --exclude '*.md' \ + --exclude 'public/Images/packages/*' \ --delete #TODO create a github-action that can be used to parse the diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 5936fe4..973fb5b 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -92,10 +92,20 @@ 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/' + - 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 }} 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,