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

Add IPFS deploy pipeline #408

Merged
merged 1 commit into from
Aug 14, 2021
Merged
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
28 changes: 0 additions & 28 deletions .github/workflows/github_action.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/preview-deploy-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: IPFS Preview Deploy - Cleanup

on:
pull_request:
types: [closed]

jobs:
cleanup:
name: Remove test environment deployment
runs-on: ubuntu-latest
steps:
- name: Inject slug variables
uses: rlespinasse/[email protected]

- name: Mark deployment as deactivated
uses: bobheadxi/[email protected]
with:
step: deactivate-env
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ env.GITHUB_HEAD_REF_SLUG_URL }}
61 changes: 61 additions & 0 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: IPFS Preview Deploy

on:
push:
branches:
- dev
pull_request:
types: [opened, synchronize, reopened]

jobs:
develop-ci:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: Inject slug variables
uses: rlespinasse/[email protected]

- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Start Deployment
uses: bobheadxi/[email protected]
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}
ref: ${{ github.head_ref }}

- name: Remove dependencies
run: rm -rf package-lock.json node_modules

- name: Install dependencies
run: npm install

- name: Build Dapp
run: npm run build:xdai

- name: Deploy to IPFS
uses: web3-storage/add-to-web3@v1
id: web3
with:
web3_token: ${{ secrets.WEB3_STORAGE_TOKEN }}
path_to_add: 'build'

- name: Update Deployment Status
uses: bobheadxi/[email protected]
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: 'https://${{ steps.web3.outputs.cid }}.ipfs.dweb.link'
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ApolloProvider, ApolloClient, InMemoryCache } from '@apollo/client'
import React, { Suspense, useEffect, useState, useCallback } from 'react'
import styled, { ThemeProvider } from 'styled-components'
import { ToastContainer } from 'react-toastify'
import { BrowserRouter } from 'react-router-dom'
import { HashRouter } from 'react-router-dom'
import { useWeb3React } from '@web3-react/core'
import { CookiesProvider } from 'react-cookie'
import Axios from 'axios'
Expand Down Expand Up @@ -84,7 +84,7 @@ export const App = () => {
<ThemeProvider theme={theme}>
<GlobalStyle />
<Suspense fallback={<Center minHeight="100vh">LOADING</Center>}>
<BrowserRouter>
<HashRouter>
<Container>
<Header />
<AppRouter />
Expand All @@ -109,7 +109,7 @@ export const App = () => {
/>
{!isMobile && <FeedbackOverlay />}
</Container>
</BrowserRouter>
</HashRouter>
</Suspense>
</ThemeProvider>
</SanctionContext.Provider>
Expand Down