Skip to content

Cron: cow.fi tokens list #9470

Cron: cow.fi tokens list

Cron: cow.fi tokens list #9470

Workflow file for this run

name: 'Cron: cow.fi tokens list'
on:
schedule:
- cron: '0 */3 * * *'
# Required for authenticating with AWS IAM
permissions:
id-token: write
contents: read
env:
NODE_VERSION: lts/gallium
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules1-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-nodemodules1-
- name: Install dependencies
run: yarn install --frozen-lockfile
generate:
name: Generate and Post to S3
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: lts/*
- name: Load dependencies
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules1-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-nodemodules1-
# TODO: Remove! just a test
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Generate token lists for cow.fi
run: USE_CACHE=false yarn cowFi:tokens
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: cowFi-tokens.json
path: src/cowFi/cowFi-tokens.json
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::693696263829:role/token-list-github-action-role
role-session-name: githubactionsession
aws-region: eu-central-1
- name: Upload to S3
run: |
aws s3 cp src/cowFi/cowFi-tokens.json s3://files.cow.fi/tokens/cowFi-tokens.json
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.DISTRIBUTION }} \
--paths "/tokens/*"