Skip to content

Commit

Permalink
add deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
junajan committed Oct 26, 2024
1 parent a766fe5 commit d6f3264
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Main CI

on:
push:
branches: [ deployment ]
# branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Copy files to prod server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "."
target: ${{ secrets.PATH }}

- name: Restart
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
envs: NODE_ENV,CALENDAR_ID,EARNINGS_HEADSUP_DAYS,GCP_CLIENT_EMAIL,GCP_PRIVATE_KEY
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
cd ${{ secrets.PATH }}
rm -rf .git
pnpm i
pnpm run prod:stop
NODE_ENV=${{ secrets.NODE_ENV }} CALENDAR_ID=${{ secrets.CALENDAR_ID }} EARNINGS_HEADSUP_DAYS=${{ secrets.EARNINGS_HEADSUP_DAYS }} GCP_CLIENT_EMAIL=${{ secrets.GCP_CLIENT_EMAIL }} GCP_PRIVATE_KEY=${{ secrets.GCP_PRIVATE_KEY }} npm run prod:start
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"calendarId": "",
"symbols": "AAPL,AMZN",
"symbols": "AAPL,AMZN,MSFT,HAS,MCD,NVDA,AMD,DELL,PG,COST,MAT,TXRH,SPGI,TWLO,INTU,OKTA,ADBE,CROX,NET,AVGO,DDOG,CP,ZM,DOCU,AI,OXY,ROKU,NKE,GOOG,MDB,KO,SMCI,F,EA,META,TSLA,CAT,STZ,MA,V,TSM,DOCU,WMT,JPM,TGT,CMG",
"earningsHeadsupDays": 0,
"gcpCredentials": {
"clientEmail": "",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"type": "module",
"scripts": {
"accept-calendar-invitation": "npx tsx ./commands/accept-calendar-invitation.command.ts",
"start": "npx tsx app/app.ts",
"prod:start": "forever start -a --uid trading-calendar -c 'npx tsx' ./app/app.ts",
"prod:stop": "forever stop trading-calendar",
"single": "npx tsx app/app.ts --single",
"start": "npx tsx app/app.ts",
"sync-cpi-events": "npx tsx ./commands/sync-cpi-events.command.ts",
"sync-dividend-events": "npx tsx ./commands/sync-dividend-events.command.ts",
"sync-earnings-events": "npx tsx ./commands/sync-earnings-events.command.ts",
Expand Down

0 comments on commit d6f3264

Please sign in to comment.