Skip to content

Commit

Permalink
chore: fission cid
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Jul 26, 2023
1 parent 1df6ce5 commit b1516b9
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 23 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/publish-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ jobs:
cache: 'pnpm'
- run: pnpm install
- run: pnpm -r --filter demo run build
- uses: fission-suite/publish-action@v1.2.7
- uses: fission-suite/publish-action@feat/cid-output
id: fission
with:
machine_key: ${{ secrets.FISSION_MACHINE_KEY }}
workdir: 'examples/demo'
- name: Add url to GITHUB_STEP_SUMMARY
run: |
echo "
### App URL 🌐
https://dweb.link/ipfs/${{ steps.fission.outputs.app_cid }}
" >> $GITHUB_STEP_SUMMARY
preview:
runs-on: ubuntu-latest
if: github.ref_name != 'master'
Expand Down
1 change: 1 addition & 0 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@acab/reset.css": "^0.5.3",
"@preact/signals": "^1.1.5",
"clsx": "^2.0.0",
"dns-over-http-resolver": "^2.1.1",
"filsnap-adapter": "workspace:^",
"iso-base": "^1.1.1",
"iso-filecoin": "^2.0.1",
Expand Down
29 changes: 28 additions & 1 deletion examples/demo/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@ import SignMessage from './components/sign-message.jsx'
import { useFilsnapContext } from './hooks/filsnap.js'
import ConnectFEVM from './components/connect-fevm.jsx'
import Forward from './components/forward.tsx'
import { useEffect, useState } from 'preact/hooks'
import Resolver from 'dns-over-http-resolver'

export function App() {
const { isConnected } = useFilsnapContext()
const [cid, setCid] = /** @type {typeof useState<string>} */ (useState)()
useEffect(() => {
async function main() {
try {
const dnsRecord = await new Resolver().resolve(
`_dnslink.${window.location.host}`,
'TXT'
)
setCid(dnsRecord[0][0].replace('dnslink=/ipfs/', ''))
} catch {}
}

main()
}, [])

return (
<main class="App">
Expand Down Expand Up @@ -55,7 +71,18 @@ export function App() {
</li>
<li>
{' '}
Workflow:{' '}
CID:{' '}
<a
target="_blank"
href={`https://${cid}.ipfs.dweb.link/`}
rel="noreferrer"
>
{cid || 'unknown'}
</a>
</li>
<li>
{' '}
Release Job:{' '}
<a
target="_blank"
href={`https://github.com/filecoin-project/filsnap/actions/runs/${
Expand Down
76 changes: 55 additions & 21 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1516b9

Please sign in to comment.