Skip to content

Commit

Permalink
add actions-gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
YouStillAlive committed Dec 20, 2024
1 parent e37a5aa commit e746821
Show file tree
Hide file tree
Showing 7 changed files with 5,262 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- master # Trigger deployment when pushing to the main branch

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.9.0

- name: Install dependencies
run: npm install

- name: Build the project
run: npm run build # This will run tsc and generate dist folder

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist # The folder that contains the built files
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
node_modules
.env
/dist
dist

# Hardhat files
/cache
Expand Down
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Config Viewer</title>
<script src="dist/index.js"></script> <!-- Refer to the compiled JS -->
</head>

<body>
<script>
// Get chainId from the URL
const urlParams = new URLSearchParams(window.location.search);
const chainId = parseInt(urlParams.get('chainId') || '');

if (isNaN(chainId)) {
document.getElementById('configOutput').textContent = 'Invalid or missing chainId in URL';
} else {
// Call loadConfig function (which is async)
loadConfig(chainId).then(config => {
document.getElementById('configOutput').textContent = JSON.stringify(config, null, 2);
}).catch(error => {
document.getElementById('configOutput').textContent = `Error: ${error.message}`;
});
}
</script>
</body>

</html>
Loading

0 comments on commit e746821

Please sign in to comment.