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

PR Deploy Preview 🤝 meets 🤝 Github Pages #1527

Merged
merged 140 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
140e730
yarn files updated
rohitmalhotra1420 May 10, 2024
9cc3455
removed package manger from package.json
rohitmalhotra1420 May 10, 2024
ae9ff76
further tweaks
HarshRajat May 6, 2024
1b18380
updated lock file
rohitmalhotra1420 May 13, 2024
9be4158
package manager updated
rohitmalhotra1420 May 13, 2024
975cf94
yarn updated to stable version
rohitmalhotra1420 May 13, 2024
0e6ca11
gitignore reverted
rohitmalhotra1420 May 13, 2024
3d02d7f
removed unused imports
rohitmalhotra1420 May 13, 2024
86b0e02
updated memory in build command
rohitmalhotra1420 May 13, 2024
4d1649a
yarn.lock updated
rohitmalhotra1420 May 6, 2024
b88c92f
gitignore reverted
rohitmalhotra1420 May 13, 2024
1660662
memory increased
rohitmalhotra1420 May 13, 2024
4074a29
package.json and lock file updated
rohitmalhotra1420 May 13, 2024
34c8f8c
removed unused libraries and imports
rohitmalhotra1420 May 13, 2024
cd52605
file formatted
rohitmalhotra1420 May 13, 2024
7d40bb0
vercel build command added
rohitmalhotra1420 May 13, 2024
6bd52a8
updated vercel build command
rohitmalhotra1420 May 13, 2024
19a8e2e
vercel build command updated
rohitmalhotra1420 May 13, 2024
5516b5f
vercel build command updated
rohitmalhotra1420 May 13, 2024
19097a4
cross env added
rohitmalhotra1420 May 13, 2024
8bc0009
rollup config and plugin added in vite config
rohitmalhotra1420 May 13, 2024
bcb7846
vite config updated
rohitmalhotra1420 May 13, 2024
4a199df
updated vite config
rohitmalhotra1420 May 13, 2024
43e79a1
fixed react,lodash and restapi imports
rohitmalhotra1420 May 14, 2024
cf1ebcf
fixed imports
rohitmalhotra1420 May 14, 2024
1034b4d
cross env removed
rohitmalhotra1420 May 14, 2024
3354820
removed used imports and fixed react imports
rohitmalhotra1420 May 14, 2024
15aff63
memory increased
rohitmalhotra1420 May 14, 2024
8c337bf
fixed warnings
rohitmalhotra1420 May 14, 2024
10e67cb
added github action
rohitmalhotra1420 May 14, 2024
0d1d0df
updated gaction version
rohitmalhotra1420 May 14, 2024
890c55f
name changed
rohitmalhotra1420 May 14, 2024
0c9616d
added branch
rohitmalhotra1420 May 14, 2024
65648ba
fixed workflow
rohitmalhotra1420 May 14, 2024
f588d4c
changed workflow
rohitmalhotra1420 May 14, 2024
3116a06
removed delete step
rohitmalhotra1420 May 14, 2024
c4dad64
preview updated
rohitmalhotra1420 May 14, 2024
4921aff
removed concurrency
rohitmalhotra1420 May 14, 2024
f4f0314
added pull request types
rohitmalhotra1420 May 14, 2024
2cdcb69
added concurrency
rohitmalhotra1420 May 14, 2024
be2f898
jobs name changed
rohitmalhotra1420 May 14, 2024
b30ddaa
workflow name fixed
rohitmalhotra1420 May 14, 2024
69ca294
updated ubuntu
rohitmalhotra1420 May 14, 2024
a5c1871
downgraded actions
rohitmalhotra1420 May 14, 2024
0bdc6fb
added closed pr condition
rohitmalhotra1420 May 14, 2024
87a29ef
commented cleanup
rohitmalhotra1420 May 14, 2024
eb994fe
commented
rohitmalhotra1420 May 14, 2024
8c49434
uncommented deployment
rohitmalhotra1420 May 14, 2024
e87f1bc
changed back to older one
rohitmalhotra1420 May 14, 2024
9772891
changed config
rohitmalhotra1420 May 14, 2024
2b2b29c
comment removed
rohitmalhotra1420 May 14, 2024
b602370
changed
rohitmalhotra1420 May 14, 2024
dfa3843
fixed react,lodash and restapi imports
rohitmalhotra1420 May 14, 2024
a15180d
cross env removed
rohitmalhotra1420 May 14, 2024
6b5e679
yarn file updated
rohitmalhotra1420 May 14, 2024
fa055ec
memory increased
rohitmalhotra1420 May 14, 2024
7d07da0
lock file updated
rohitmalhotra1420 May 14, 2024
316f3e6
config updated
rohitmalhotra1420 May 14, 2024
24fe227
fixed the workflow
rohitmalhotra1420 May 14, 2024
f222d66
fixed workflow
rohitmalhotra1420 May 15, 2024
c16547f
removed deploy step dependency
rohitmalhotra1420 May 15, 2024
850de81
fixed cleanup function
rohitmalhotra1420 May 15, 2024
0dc3eb7
fixed imports
rohitmalhotra1420 May 15, 2024
c3d629d
changed build folder
rohitmalhotra1420 May 15, 2024
18f0af6
changed back build folder
rohitmalhotra1420 May 15, 2024
0825feb
added write permissions
rohitmalhotra1420 May 15, 2024
f5f6c71
changes
rohitmalhotra1420 May 15, 2024
c7f82b7
permission removed
rohitmalhotra1420 May 15, 2024
f2f5c3c
permission removed
rohitmalhotra1420 May 15, 2024
9d27399
updated vite config
rohitmalhotra1420 May 15, 2024
09f2a78
updated the preview workflow
rohitmalhotra1420 May 15, 2024
2d4407c
updated the preview workflow
rohitmalhotra1420 May 15, 2024
df7548c
updated the preview command
rohitmalhotra1420 May 15, 2024
9174e61
updated version of preview action
rohitmalhotra1420 May 15, 2024
adab232
reverted changes
rohitmalhotra1420 May 15, 2024
4dd429b
changed preview conditions
rohitmalhotra1420 May 15, 2024
6751d11
comented remove preview
rohitmalhotra1420 May 15, 2024
75cb199
revertd to previous version
rohitmalhotra1420 May 15, 2024
8607c01
added env var in preview worklfow
rohitmalhotra1420 May 15, 2024
cd9da7d
fixed path in vite config+build command fix+preview fix
rohitmalhotra1420 May 15, 2024
927423d
removed base
rohitmalhotra1420 May 15, 2024
eda4df1
removed base
rohitmalhotra1420 May 15, 2024
5ba7419
fixed base name in browser router
rohitmalhotra1420 May 15, 2024
9495c2f
base path fallback set
rohitmalhotra1420 May 15, 2024
171f758
logged url
rohitmalhotra1420 May 15, 2024
2235716
fixed base
rohitmalhotra1420 May 15, 2024
30ba297
fixed import
rohitmalhotra1420 May 15, 2024
7627e55
try a hack
rohitmalhotra1420 May 15, 2024
f1bf2f2
added logs
rohitmalhotra1420 May 15, 2024
c6a3ccb
exports changed
rohitmalhotra1420 May 15, 2024
86e3f77
fixed the preview basepath
rohitmalhotra1420 May 15, 2024
025c6f6
fixed the env vriable
rohitmalhotra1420 May 15, 2024
f967f10
set env variable
rohitmalhotra1420 May 15, 2024
d002b0b
fixed env variable in workflow
rohitmalhotra1420 May 15, 2024
87ca21f
updated _redirects file and added PR cleanup
rohitmalhotra1420 May 17, 2024
cad6348
fixed warnings
rohitmalhotra1420 May 14, 2024
de6a81f
lock file updated
rohitmalhotra1420 May 17, 2024
f7d7217
removed basepath from vite config
rohitmalhotra1420 May 18, 2024
d705c34
Removed basepath from index file
rohitmalhotra1420 May 18, 2024
c9a79bf
Reverted previous changes and added nojekyll file
rohitmalhotra1420 May 18, 2024
5ec6f0a
changed basepath
rohitmalhotra1420 May 18, 2024
a1c6625
rverted changes + added hashrouter
rohitmalhotra1420 May 18, 2024
e5f6b17
removed hashrouter
rohitmalhotra1420 May 18, 2024
fbfb8a4
updated build script
rohitmalhotra1420 May 18, 2024
541135b
updated configuration for preview
rohitmalhotra1420 May 18, 2024
94fdea7
updated preview deploy config
rohitmalhotra1420 May 19, 2024
76d350f
changed 404.html
rohitmalhotra1420 May 19, 2024
74dedbd
fixed regex
rohitmalhotra1420 May 19, 2024
7b95fa3
404 fix
rohitmalhotra1420 May 19, 2024
7eea154
reverted back 404 page
rohitmalhotra1420 May 19, 2024
ba0fd8f
added hash router
rohitmalhotra1420 May 19, 2024
e3f929c
removed hash router
rohitmalhotra1420 May 19, 2024
4bf605e
changed 404 file
rohitmalhotra1420 May 19, 2024
eb6c541
404 reverted
rohitmalhotra1420 May 19, 2024
d6d07fc
changed basepath
rohitmalhotra1420 May 19, 2024
77428d3
updated 404
rohitmalhotra1420 May 19, 2024
12038d8
updated 404
rohitmalhotra1420 May 19, 2024
588ac8a
updated 404
rohitmalhotra1420 May 19, 2024
0d44426
updated 404
rohitmalhotra1420 May 19, 2024
41881e9
updated 404
rohitmalhotra1420 May 19, 2024
f9507d3
redirects file changed
rohitmalhotra1420 May 19, 2024
0b24a7e
updated public/index.html
rohitmalhotra1420 May 19, 2024
f633e66
updated public/index.html
rohitmalhotra1420 May 19, 2024
dff2b40
fixed basepath
rohitmalhotra1420 May 19, 2024
1450bc1
added fixed basepath
rohitmalhotra1420 May 19, 2024
584253a
added fixed basepath ii
rohitmalhotra1420 May 19, 2024
f594f75
changed homepage url
rohitmalhotra1420 May 20, 2024
fdb1b91
changed homepage url ii
rohitmalhotra1420 May 20, 2024
62e5b78
changed homepage back
rohitmalhotra1420 May 20, 2024
3d94b4c
updated 404 page
rohitmalhotra1420 May 20, 2024
7be3b00
added comment in 404 page
rohitmalhotra1420 May 20, 2024
19d6d95
asset path helper+vite base fix
rohitmalhotra1420 May 20, 2024
cb5f3af
public image paths fixed
rohitmalhotra1420 May 20, 2024
8208576
link fixed in header
rohitmalhotra1420 May 20, 2024
8a039b9
mobile log path fix + chat page fix
rohitmalhotra1420 May 20, 2024
6bdef79
updated index-preview.html
rohitmalhotra1420 May 20, 2024
5c0b703
fixed path in index-preview.html
rohitmalhotra1420 May 20, 2024
511b284
more icon paths fixed
rohitmalhotra1420 May 20, 2024
0cd54c6
Update App.tsx to include useInactiveListener hook
mishramonalisha76 May 20, 2024
81c5879
Updated AutoImageClipper.tsx
rohitmalhotra1420 May 20, 2024
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
48 changes: 48 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy PR previews
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
branches:
- main
concurrency: preview-${{ github.ref }}
jobs:
deploy-preview:
runs-on: ubuntu-20.04
steps:
- name: Set up environment variables
run: |
echo "VITE_PR_PREVIEW_BASE=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "VITE_APP_NODE_ENV=production" >> $GITHUB_ENV
echo "VITE_APP_DEPLOY_ENV=PREVIEW" >> $GITHUB_ENV
echo "VITE_APP_PUBLIC_URL=https://push-protocol.github.io/" >> $GITHUB_ENV
echo "ESLINT_NO_DEV_ERRORS=true" >> $GITHUB_ENV
echo "TSC_COMPILE_ON_ERROR=true" >> $GITHUB_ENV
echo "DISABLE_ESLINT_PLUGIN=true" >> $GITHUB_ENV
echo "GENERATE_SOURCEMAP=true" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3

- name: Install and Build
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed
env:
VITE_APP_WALLETCONNECT_PROJECT_ID: ${{ secrets.VITE_APP_WALLETCONNECT_PROJECT_ID }}

run: |
yarn install
yarn build:pr:preview
- name: Deploy preview
uses: rossjrw/[email protected]
with:
source-dir: ./build/

- uses: rossjrw/[email protected]
if: github.event.action == 'closed' && !github.event.pull_request.merged
with:
source-dir: ./build/
action: remove
873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.4.1.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.2.2.cjs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
yarnPath: .yarn/releases/yarn-3.4.1.cjs
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.2.2.cjs
35 changes: 17 additions & 18 deletions README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions basePath.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function getPreviewBasePath() {
if (typeof import.meta !== 'undefined' && import.meta.env) {
// Vite environment
return import.meta.env.VITE_PR_PREVIEW_BASE ? `/push-dapp/pr-preview/${import.meta.env.VITE_PR_PREVIEW_BASE}` : '';
} else if (typeof process !== 'undefined' && process.env) {
// Node.js environment (e.g., during the build process)
return process.env.VITE_PR_PREVIEW_BASE ? `/push-dapp/pr-preview/${process.env.VITE_PR_PREVIEW_BASE}` : '';
}
return '';
}
26 changes: 22 additions & 4 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import chalk from 'chalk';
import { parse } from 'envfile';
import fs from 'fs';
import readline from 'readline';
import { getPreviewBasePath } from './basePath.js';

const envPresets = {
alpha: {
Expand All @@ -24,6 +25,10 @@ const envPresets = {
VITE_APP_DEPLOY_ENV: 'PROD',
VITE_APP_PUBLIC_URL: 'https://app.push.org/',
},
preview: {
VITE_APP_DEPLOY_ENV: 'PREVIEW',
VITE_APP_PUBLIC_URL: `https://push-protocol.github.io${getPreviewBasePath()}`,
},
// alpha: {
// VITE_APP_DEPLOY_ENV: 'ALPHA',
// VITE_APP_PUBLIC_URL: 'https://alpha.epns.io/',
Expand All @@ -48,13 +53,22 @@ const envPresets = {

// Prep for deployment starts everything
const prepForDeployment = async (appEnv) => {
console.log(chalk.green('Starting Custom Deployment Prebuild...' ));
console.log(chalk.green('Starting Custom Deployment Prebuild...'));

// Test if app dev is passed, else fail
let indexAppEnv = appEnv;
if (appEnv !== 'dev' && appEnv !== 'staging' && appEnv !== 'prod' && appEnv !== 'w2w' && appEnv !== 'alpha') {
if (
appEnv !== 'dev' &&
appEnv !== 'staging' &&
appEnv !== 'prod' &&
appEnv !== 'w2w' &&
appEnv !== 'alpha' &&
appEnv !== 'preview'
) {
console.log(
chalk.red('App Environment not set correctly... can only be dev, staging, prod, alpha or w2w. Please check and retry'),
chalk.red(
'App Environment not set correctly... can only be dev, staging, prod, alpha or w2w. Please check and retry'
)
);
process.exit(1);
}
Expand All @@ -79,6 +93,10 @@ const prepForDeployment = async (appEnv) => {
indexAppEnv = 'prod';
}

if (appEnv === 'preview_push') {
indexAppEnv = 'preview';
}

await changeIndexHTML(indexAppEnv);
await changeENV(appEnv);
};
Expand All @@ -104,7 +122,7 @@ const changeIndexHTML = async (appEnv) => {

const sitemaptxtcontent = fs.readFileSync(sitemapreplacepath, 'utf8');
fs.writeFileSync(sitemappath, sitemaptxtcontent, { flag: 'w' });
}
};

const changeENV = async (appEnv) => {
console.log(chalk.green.dim(' -- Generating custom .env file...'));
Expand Down
161 changes: 122 additions & 39 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/">
<base href="/" />
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Ethereum Push Notification Service (EPNS) | Subscribe. Notify. Earn" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#cf1c84" />
<meta name="msapplication-TileColor" content="#9f00a7" />
<meta name="theme-color" content="#ffffff" />

<link
rel="icon"
href="/favicon.ico"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
<meta
name="theme-color"
content="#000000"
/>
<meta
name="description"
content="Ethereum Push Notification Service (EPNS) | Subscribe. Notify. Earn"
/>
<link
rel="apple-touch-icon"
href="/logo192.png"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<link
rel="mask-icon"
href="/safari-pinned-tab.svg"
color="#cf1c84"
/>
<meta
name="msapplication-TileColor"
content="#9f00a7"
/>
<meta
name="theme-color"
content="#ffffff"
/>

<!-- Content Security Policy (CSP) to help add a layer of protection against Cross-Site Scripting (XSS), clickjacking, and other code injection attacks -->
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; object-src 'none'; frame-src 'none'; base-uri 'none';" /> -->

<!-- <script type="text/javascript" src="https://app.olvy.co/script.js" defer="defer"></script> -->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/site.webmanifest" />
<link
rel="manifest"
href="/site.webmanifest"
/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -34,27 +76,63 @@
-->
<!-- HTML Meta Tags -->
<title>Push App (Previously EPNS) | Communication Protocol of Web3</title>
<meta name="description" content="Push App (Previously EPNS) | Communication Protocol of Web3">
<meta
name="description"
content="Push App (Previously EPNS) | Communication Protocol of Web3"
/>

<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://app.push.org">
<meta property="og:type" content="website">
<meta property="og:title" content="Push App (Previously EPNS)">
<meta property="og:description" content="Push App (Previously EPNS) | Communication Protocol of Web3">
<meta property="og:image" content="https://app.push.org/previews/homepage.jpg">
<meta
property="og:url"
content="https://app.push.org"
/>
<meta
property="og:type"
content="website"
/>
<meta
property="og:title"
content="Push App (Previously EPNS)"
/>
<meta
property="og:description"
content="Push App (Previously EPNS) | Communication Protocol of Web3"
/>
<meta
property="og:image"
content="https://app.push.org/previews/homepage.jpg"
/>

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="app.push.org">
<meta property="twitter:url" content="https://app.push.org">
<meta name="twitter:title" content="Push App (Previously EPNS)">
<meta name="twitter:description" content="Push App (Previously EPNS) | Communication Protocol of Web3">
<meta name="twitter:image" content="https://app.push.org/previews/homepagetwitter.jpg">
<meta
name="twitter:card"
content="summary_large_image"
/>
<meta
property="twitter:domain"
content="app.push.org"
/>
<meta
property="twitter:url"
content="https://app.push.org"
/>
<meta
name="twitter:title"
content="Push App (Previously EPNS)"
/>
<meta
name="twitter:description"
content="Push App (Previously EPNS) | Communication Protocol of Web3"
/>
<meta
name="twitter:image"
content="https://app.push.org/previews/homepagetwitter.jpg"
/>

<!-- Meta Tags Generated via https://www.opengraph.xyz -->

<!-- Start Single Page Apps for GitHub Pages -->
<script type="text/javascript">
<!-- Start Single Page Apps for GitHub Pages -->
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
Expand All @@ -65,16 +143,18 @@
// When the single page app is loaded further down in this file,
// the correct url will be waiting in the browser's history for
// the single page app to route accordingly.
(function(l) {
if (l.search[1] === '/' ) {
var decoded = l.search.slice(1).split('&').map(function(s) {
return s.replace(/~and~/g, '&')
}).join('?');
window.history.replaceState(null, null,
l.pathname.slice(0, -1) + decoded + l.hash
);
(function (l) {
if (l.search[1] === '/') {
var decoded = l.search
.slice(1)
.split('&')
.map(function (s) {
return s.replace(/~and~/g, '&');
})
.join('?');
window.history.replaceState(null, null, l.pathname.slice(0, -1) + decoded + l.hash);
}
}(window.location))
})(window.location);
</script>
<!-- End Single Page Apps for GitHub Pages -->
</head>
Expand All @@ -83,7 +163,10 @@
<div id="root"></div>
<div id="portal"></div>
<div id="onboard-container"></div>
<script type="module" src="/src/index.tsx"></script>
<script
type="module"
src="/src/index.tsx"
></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
Loading
Loading