Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test deploy #1

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Deploy Score

on:
pull_request:
branches:
- staging
- main
workflow_dispatch:
inputs:
environment:
type: choice
options:
- staging
- main
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout GitHub Actions
uses: actions/checkout@v3
with:
repository: Staketab/github-actions
path: .github/actions
token: ${{ secrets.GH_TOKEN }}

- name: calculate environment
run: |
pull_request_branch=${{ github.base_ref }}
dispatch_branch=${{ github.event.inputs.environment }}
echo "ENVIRONMENT=${pull_request_branch:-$dispatch_branch}" >> $GITHUB_ENV

- name: Settings
uses: kanga333/[email protected]
id: settings
with:
key: ${{ env.ENVIRONMENT }}
map: |
{
"^staging$": {
"node_env": "development",
"webroot": "/var/www/test/score",
"ssh_hostname": "${{ secrets.FRONT_SCORE_IP }}",
"ssh_password": "${{ secrets.FRONT_SCORE_SSH }}",
"lib_latest": "true",
"keep_source_maps": "false"
},
"^main$": {
"node_env": "production",
"webroot": "/var/www/prod/score",
"ssh_hostname": "${{ secrets.FRONT_SCORE_IP }}",
"ssh_password": "${{ secrets.FRONT_SCORE_SSH }}",
"lib_latest": "false",
"keep_source_maps": "false"
}
}
export_to: output,log
mode: fill

- name: Deploy React.js
uses: ./.github/actions/frontend-next-deploy-score
with:
webroot: ${{ steps.settings.outputs.webroot }}
ssh_hostname: ${{ steps.settings.outputs.ssh_hostname }}
ssh_username: ${{ secrets.SERVER_USERNAME }}
ssh_password: ${{ steps.settings.outputs.ssh_password }}
lib_latest: ${{ steps.settings.outputs.lib_latest }}
keep_source_maps: ${{ steps.settings.outputs.keep_source_maps }}
nodejs_version: 16.x
github_token: ${{ secrets.GH_TOKEN }}
env:
REACT_APP_ENVIRONMENT: ${{ steps.settings.outputs.node_env }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/contracts
85 changes: 85 additions & 0 deletions ui/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"settings": {
"react": {
"version": "detect"
},
"import/extensions": [".js", ".ts", ".tsx", ".d.ts"],
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".tsx", ".d.ts"]
},
"typescript": {
"alwaysTryTypes": true
}
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"]
}
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
"overrides": [
{
"env": {
"node": true
},
"files": [".eslintrc.{js,cjs}"],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["@typescript-eslint/eslint-plugin", "import", "prettier", "react", "react-hooks"],
"rules": {
"react-hooks/rules-of-hooks": "error",
"semi": "error",
"linebreak-style": ["error", "unix"],
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"prettier/prettier": ["error"],
"react/prop-types": "off",
"no-unused-vars": "off",
"no-nested-ternary": "error",
"no-else-return": ["error", { "allowElseIf": false }],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "_", "varsIgnorePattern": "_" }],
"@typescript-eslint/no-explicit-any": "warn",
"react/react-in-jsx-scope": "off",
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": ["state", "nextState"]
}
],
"react-hooks/exhaustive-deps": "warn"
}
}
35 changes: 35 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
8 changes: 8 additions & 0 deletions ui/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
"endOfLine": "auto",
"tabWidth": 4
}
4 changes: 4 additions & 0 deletions ui/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public/legacy/**/*.css
public/normalize.css
public/brands/**/theme.css
storybook-static
42 changes: 42 additions & 0 deletions ui/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"plugins": ["stylelint-declaration-strict-value"],
"rules": {
"scale-unlimited/declaration-strict-value": [
["/color$/", "fill", "stroke"],
{
"ignoreKeywords": {
"/color$/": ["currentColor", "transparent", "inherit"],
"fill": ["currentColor", "inherit"],
"stroke": "currentColor",
"z-index": 0
}
}
],
"indentation": 4,
"selector-class-pattern": null,
"selector-id-pattern": null,
"custom-property-pattern": null,
"length-zero-no-unit": null,
"color-function-notation": null,
"alpha-value-notation": null,
"property-no-unknown": [
true,
{
"ignoreProperties": ["composes", "compose-with"]
}
],
"value-keyword-case": null,
"string-quotes": "single",
"font-family-name-quotes": null,
"font-family-no-missing-generic-family-keyword": null,
"no-descending-specificity": null,
"declaration-block-no-redundant-longhand-properties": null,
"selector-pseudo-class-no-unknown": null,
"value-no-vendor-prefix": null,
"property-no-vendor-prefix": null,
"selector-type-no-unknown": null,
"selector-no-vendor-prefix": null,
"keyframes-name-pattern": null
}
}
38 changes: 38 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
35 changes: 35 additions & 0 deletions ui/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,


webpack(config) {
config.resolve.alias = {
...config.resolve.alias,
o1js: require('path').resolve('node_modules/o1js')
};
config.experiments = { ...config.experiments, topLevelAwait: true };
return config;
},
// To enable o1js for the web, we must set the COOP and COEP headers.
// See here for more information: https://docs.minaprotocol.com/zkapps/how-to-write-a-zkapp-ui#enabling-coop-and-coep-headers
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
{
key: 'Cross-Origin-Embedder-Policy',
value: 'require-corp',
},
],
},
];
}
};

module.exports = nextConfig
Loading
Loading