diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 0000000..f7999d8 --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,67 @@ +name: GitHub Pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Read .nvmrc + id: nvm + run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: '${{ steps.nvm.outputs.version }}' + cache: 'npm' + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + + - name: npm install + run: npm i + + - name: Create production .env + run: echo "REACT_APP_DEBUG=false" > .env + + - name: Build + run: npm run build + env: + PUBLIC_URL: ${{ steps.pages.outputs.base_path }} + + - name: Prepare Pages files + run: | + touch build/.nojekyll + cp build/index.html build/404.html + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/package-lock.json b/package-lock.json index 0e6f5fb..61a3466 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dapp-example", - "version": "2.4.0", + "version": "2.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dapp-example", - "version": "2.4.0", + "version": "2.5.0", "dependencies": { "@emurgo/cardano-serialization-lib-browser": "14.1.2", "@emurgo/cip4-js": "^1.0.7", diff --git a/package.json b/package.json index 847b080..34d9c09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dapp-example", - "version": "2.4.0", + "version": "2.5.0", "private": true, "dependencies": { "@emurgo/cardano-serialization-lib-browser": "14.1.2", diff --git a/public/.nojekyll b/public/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/src/index.js b/src/index.js index 4898019..946530f 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,8 @@ import {BitcoinProvider} from './hooks/bitcoinProvider' import {ToastProvider} from './hooks/toastProvider' import {BrowserRouter, Route, Routes} from 'react-router-dom' +const routerBasename = process.env.PUBLIC_URL || undefined + const root = ReactDOM.createRoot(document.getElementById('root')) root.render( @@ -17,7 +19,7 @@ root.render( - + } />