Skip to content

pin-to-pinata

pin-to-pinata #15887

name: pin-to-pinata
on:
schedule:
- cron: "0 * * * *" # run every hour
workflow_dispatch:
jobs:
pin-to-pinata:
name: Pin images to Pinata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}
- run: npm ci
- id: build
run: npm run build -- --cache-dir=".turbo"
- name: Set current date as env variable
run: echo "NOW=$(date +'%s')000" >> $GITHUB_ENV
- name: Set from date as env variable
run: echo "FROM_DATE=$(( $NOW - 24 * 60 * 60 * 1000 ))" >> $GITHUB_ENV
- name: Pin for each env
env:
PINATA_JWT: ${{ secrets.PINATA_JWT }}
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
INFURA_PROJECT_SECRET: ${{ secrets.INFURA_PROJECT_SECRET }}
run: |
echo "Pin for testing/amoy env..."
npm run pin-to-pinata -- \
-e testing \
-c testing-80002-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
echo "Pin for testing/sepolia env..."
npm run pin-to-pinata -- \
-e testing \
-c testing-11155111-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
echo "Pin for staging/amoy env..."
npm run pin-to-pinata -- \
-e staging \
-c staging-80002-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
echo "Pin for staging/sepolia env..."
npm run pin-to-pinata -- \
-e staging \
-c staging-11155111-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
echo "Pin for production/polygon env..."
npm run pin-to-pinata -- \
-e production \
-c production-137-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
echo "Pin for production/ethereum env..."
npm run pin-to-pinata -- \
-e production \
-c production-1-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}