Skip to content

Commit

Permalink
attempt3
Browse files Browse the repository at this point in the history
  • Loading branch information
emrergin committed Jan 4, 2024
1 parent f37c9e0 commit 7efba09
Show file tree
Hide file tree
Showing 51 changed files with 1,853 additions and 1,693 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI and Deployment

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Dependencies
run: npm install
- name: Generate date and write to file
run: echo "const buildDate = '`date +%Y%m%d%H%M`'; export default buildDate;" > buildDate.ts
- name: Build
run: npm run buildfordeploy
- name: Prepare files
run: |
cp -r public .next/standalone
cp -r ./.next/static .next/standalone/.next
- name: Archive files
uses: actions/upload-artifact@v2
with:
name: app
path: .next/standalone

deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Download files
uses: actions/download-artifact@v2
with:
name: app
path: temporaryfolder
- name: copy file via ssh password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: temporaryfolder/*
target: /home/${{ secrets.USERNAME }}/servers/belief/standalone
strip_components: 1
- name: executing remote ssh commands
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cp /home/${{ secrets.USERNAME }}/servers/.env /home/${{ secrets.USERNAME }}/servers/belief/standalone/.env
sed -i 's/3000/3002/g' /home/${{ secrets.USERNAME }}/servers/belief/standalone/server.js
pm2 restart /home/${{ secrets.USERNAME }}/servers/belief/standalone/server.js --name belief
pm2 save
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

exporting.*
buildDate.*
5 changes: 2 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"tabWidth": 4,
"useTabs": true
}
"useTabs": true
}
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

Web based experimentation for the belief elicitation, specifically quadratic and binarized scoring rules.

Joint project with [Mehmet Yiğit Gürdal](https://econ.boun.edu.tr/mehmet-yigit-gurdal-0).
Joint project with [Mehmet Yiğit Gürdal](https://econ.boun.edu.tr/mehmet-yigit-gurdal-0) and [Tolga Umut Kuzubaş](https://econ.bogazici.edu.tr/tolga-umut-kuzubas).

## Setup
- `npm install`
- Setup env variables.
- `npx prisma generate`
- `npm run dev`

## Technologies Used

Expand All @@ -26,10 +32,11 @@ Some introductory readings for the concepts.
- https://stackoverflow.com/questions/34189370/how-to-repeat-an-element-n-times-using-jsx-and-lodash
- https://blog.logrocket.com/effortless-database-schema-migration-prisma/
- https://reacthustle.com/blog/flatten-object-javascript-typescript
- https://codepen.io/mr-t77/pen/jRzmMZ

## What I learned
- This is the first Next.js app I completed.
- This is the first time I am using Prisma, and also PostgreSQL.
- This is the first **Next.js** app I completed.
- This is the first time I am using **Prisma**, and also **PostgreSQL**.
- For autoanimate to work as expected, the parent element needs to have a specified width.
- My first use case of ``Intl.ListFormat``.
- I learned that `new Date()` is not safe to use with Next.js outside of a useEffect call.
10 changes: 0 additions & 10 deletions exporting.sh

This file was deleted.

Loading

0 comments on commit 7efba09

Please sign in to comment.