Commit 0b8d05b6 authored by Moody Salem's avatar Moody Salem Committed by GitHub

Add a new target for deploying to IPFS (#819)

* Add a new target for deploying to IPFS

* verbose command

* Try the github action
parent 425a2377
on:
push:
branches:
- v2
name: Deploy to IPFS
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12'
- run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn ipfs-build
- name: Upload to IPFS
id: upload
uses: aquiladev/ipfs-action@v1
with:
path: build/
\ No newline at end of file
{
"name": "uniswap",
"description": "Uniswap Protocol",
"description": "Uniswap Interface",
"version": "0.1.0",
"homepage": "https://uniswap.exchange",
"private": true,
......@@ -83,8 +83,9 @@
"typescript": "^3.8.3"
},
"scripts": {
"start": "cross-env REACT_APP_GIT_COMMIT_HASH=$(git show -s --format=%H) react-scripts start",
"start": "react-scripts start",
"build": "cross-env REACT_APP_GIT_COMMIT_HASH=$(git show -s --format=%H) react-scripts build",
"ipfs-build": "cross-env PUBLIC_URL=\".\" react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
......
......@@ -28,7 +28,7 @@
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" />
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
......
import React, { Suspense } from 'react'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import { BrowserRouter, HashRouter, Route, Switch } from 'react-router-dom'
import styled from 'styled-components'
import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter'
import Footer from '../components/Footer'
......@@ -67,10 +67,17 @@ const BackgroundGradient = styled.div`
}
`
let Router: React.ComponentType
if (process.env.PUBLIC_URL === '.') {
Router = HashRouter
} else {
Router = BrowserRouter
}
export default function App() {
return (
<Suspense fallback={null}>
<BrowserRouter>
<Router>
<Route component={GoogleAnalyticsReporter} />
<Route component={DarkModeQueryParamReader} />
<AppWrapper>
......@@ -96,7 +103,7 @@ export default function App() {
</BodyWrapper>
<BackgroundGradient />
</AppWrapper>
</BrowserRouter>
</Router>
<div id="popover-container" />
</Suspense>
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment