-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 1.43 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 }}