Skip to content

Commit

Permalink
Migrate to Deno. At least, version that works!
Browse files Browse the repository at this point in the history
  • Loading branch information
somespecialone committed Nov 9, 2024
1 parent 654a130 commit dc5e915
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 72 deletions.
112 changes: 56 additions & 56 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
name: API

on:
workflow_run:
workflows: [ Release ]
types: [ completed ]

release:
types: [ published ]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install

- name: Build server code
run: pnpm api:build

- uses: actions/upload-artifact@v4
with:
name: build
path: |
api/.output
api/wrangler.toml
retention-days: 1
include-hidden-files: true

deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: cloudflare
url: https://sert.somespecialone.workers.dev
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: .output

- name: Move deploy configuration
run: mv .output/wrangler.toml .

- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
#name: API
#
#on:
# workflow_run:
# workflows: [ Release ]
# types: [ completed ]
#
# release:
# types: [ published ]
#
#jobs:
# build:
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: pnpm
# - run: pnpm install
#
# - name: Build server code
# run: pnpm api:build
#
# - uses: actions/upload-artifact@v4
# with:
# name: build
# path: |
# api/.output
# api/wrangler.toml
# retention-days: 1
# include-hidden-files: true
#
# deploy:
# needs: build
# runs-on: ubuntu-latest
# timeout-minutes: 10
# environment:
# name: cloudflare
# url: https://sert.somespecialone.workers.dev
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: build
# path: .output
#
# - name: Move deploy configuration
# run: mv .output/wrangler.toml .
#
# - name: Deploy
# uses: cloudflare/wrangler-action@v3
# with:
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/converter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ concurrency:
cancel-in-progress: false

env:
# PUBLIC_API_BASE_URL: https://sert.somespecial.one
PUBLIC_API_BASE_URL: https://sert.somespecialone.workers.dev
PUBLIC_API_BASE_URL: https://sert.somespecial.one

jobs:
build:
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@
>
> **Web converter [converter.somespecial.one](https://converter.somespecial.one) 🧮**
>
> **API [sert.somespecialone.workers.dev](https://sert.somespecialone.workers.dev)**
> **API [sert.somespecial.one](https://sert.somespecial.one)**
>
> **Python API consumer [aiosteampy.converter](https://github.com/somespecialone/aiosteampy/blob/master/aiosteampy/converter.py)**
## Migration!

> [!WARNING]
> API has been moved to [sert.somespecialone.workers.dev](https://sert.somespecialone.workers.dev) address
> **Python API consumer [aiosteampy.converter](https://github.com/somespecialone/aiosteampy/blob/master/aiosteampy/ext/converter.py)**
## How it works

Every hour on [9 and 39 minute](./deployment/Spacefile) app checks if rates data in db is expired (updated yesterday or even older)
and if true, [update currency rates](./api/cron/index.ts):
Every hour on **9 and 39 minute** app checks if rates data in db is expired (updated yesterday or even older)
and if true, _update currency rates_:

1. Get data of specified item on steammarket for each needed currency.
2. Calculate exchange rates by comparing item price in previously fetched currencies.
Expand Down Expand Up @@ -101,8 +96,8 @@ All currency rates eval to 1 USD 💵.

Examples:

* https://sert.somespecialone.workers.dev/history?length=20
* https://sert.ssomespecialone.workers.dev/history?all
* https://sert.somespecial.one/history?length=20
* https://sert.ssomespecial.one/history?all


[//]: # (## Tests 🧪)
Expand Down
9 changes: 6 additions & 3 deletions converter/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@
<div class="made-with">
with
<a href="https://svelte.dev/" target="_blank" rel="noreferrer"><Icon icon="ri:svelte-fill" height="1.4rem" /></a>
<a href="https://nitro.unjs.io/" target="_blank" rel="noreferrer"><Icon icon="unjs:nitro" height="1.4rem" /></a>
<a href="https://www.cloudflare.com/" target="_blank" rel="noreferrer">
<Icon icon="devicon-plain:cloudflare" height="1.4rem" />
<!-- <a href="https://nitro.unjs.io/" target="_blank" rel="noreferrer"><Icon icon="unjs:nitro" height="1.4rem" /></a>-->
<a href="https://deno.com/" target="_blank" rel="noreferrer">
<Icon icon="lineicons:deno" height="1.4rem" />
</a>
<a href="https://github.com/" target="_blank" rel="noreferrer"><Icon icon="mdi:github" height="1.4rem" /></a>
<a href="https://steamcommunity.com/" target="_blank" rel="noreferrer">
<Icon icon="mdi:steam" height="1.4rem" />
</a>
<Icon icon="mdi:heart" height="1.4rem" color="#ffce24" />
</div>
</footer>
Expand Down

0 comments on commit dc5e915

Please sign in to comment.