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", "name": "uniswap",
"description": "Uniswap Protocol", "description": "Uniswap Interface",
"version": "0.1.0", "version": "0.1.0",
"homepage": "https://uniswap.exchange", "homepage": "https://uniswap.exchange",
"private": true, "private": true,
...@@ -83,8 +83,9 @@ ...@@ -83,8 +83,9 @@
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"scripts": { "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", "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", "test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" /> <div id="root"></div>
<!-- <!--
This HTML file is a template. This HTML file is a template.
If you open it directly in the browser, you will see an empty page. If you open it directly in the browser, you will see an empty page.
......
import React, { Suspense } from 'react' 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 styled from 'styled-components'
import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter' import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter'
import Footer from '../components/Footer' import Footer from '../components/Footer'
...@@ -67,10 +67,17 @@ const BackgroundGradient = styled.div` ...@@ -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() { export default function App() {
return ( return (
<Suspense fallback={null}> <Suspense fallback={null}>
<BrowserRouter> <Router>
<Route component={GoogleAnalyticsReporter} /> <Route component={GoogleAnalyticsReporter} />
<Route component={DarkModeQueryParamReader} /> <Route component={DarkModeQueryParamReader} />
<AppWrapper> <AppWrapper>
...@@ -96,7 +103,7 @@ export default function App() { ...@@ -96,7 +103,7 @@ export default function App() {
</BodyWrapper> </BodyWrapper>
<BackgroundGradient /> <BackgroundGradient />
</AppWrapper> </AppWrapper>
</BrowserRouter> </Router>
<div id="popover-container" /> <div id="popover-container" />
</Suspense> </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