Skip to content

Fetch Crypto Prices and Create Release #1369

Fetch Crypto Prices and Create Release

Fetch Crypto Prices and Create Release #1369

Workflow file for this run

name: Fetch Crypto Prices and Create Release
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
fetch-and-release:
runs-on: ubuntu-latest
env:
TZ: America/New_York
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y.%m.%d.%H')"
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '23'
- name: Output Date
run: echo ${{ steps.date.outputs.date }}
- name: Install dependencies with pnpm
run: |
npm install --frozen-lockfile
- name: Run script to fetch prices
env:
CMC_API_KEY: ${{ secrets.CMC_API_KEY }}
run: node src/index.js
- name: Commit and push crypto_prices.json
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Updated Pricing"
file_pattern: dist/prices.json
- name: Create and push initial tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag ${{ steps.date.outputs.date }}
git push origin ${{ steps.date.outputs.date }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/prices.json
tag_name: ${{ steps.date.outputs.date }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}