From 15cc1f06eda1a055c9bed16d243b054254ea9a44 Mon Sep 17 00:00:00 2001 From: Brian Ginsburg <7957636+bgins@users.noreply.github.com> Date: Thu, 22 Sep 2022 12:10:28 -0700 Subject: [PATCH] Add route support for Fission app publishing (#66) * Add trailing slash always * Add leading slashes to gotos * Add fission.yaml and publish action * Update Fission app name * Update README Co-authored-by: Brian Ginsburg --- .DS_Store | Bin 6148 -> 0 bytes .github/workflows/publish.yml | 26 +++++++++++++++ README.md | 32 ++++++++++++++----- fission.yaml | 3 ++ src/components/Header.svelte | 2 +- src/components/auth/backup/AreYouSure.svelte | 5 ++- src/components/auth/backup/Backup.svelte | 5 ++- svelte.config.js | 3 +- 8 files changed, 64 insertions(+), 12 deletions(-) delete mode 100644 .DS_Store create mode 100644 .github/workflows/publish.yml create mode 100644 fission.yaml diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 7b0093dd2614599ac07e45bd06ac919781845e9e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyH3ME5S)WZ1kt3Vyf28vA2^9!L;?!(11O{nN=5IE&&emk?1L!A&{CjTX?O1S zc6{~}-a7zg`L??QW&oyiL%drUo2{FV>>@LU#h>wr4Z8LI@Uq>Hs((%x_X_t|V}%Z9 z{KJ+j_F4=2{KJhS;2KY?T%g4RagJB)V#gEX_>JK-1t}l}q<|EV0#d*gV9z$2-UKR2 z0VyB_P72unq0$YT#6Hk}9SnASxAlpk8OMH?Al95WiG3hfXeFq`pq9L1l%O+Tv#v?( z1A~s@JM%fYbIBV@@!grPUXIcPDoOz(2 yl)ZKIan@@q{h9t{to3q+!6ASXYsI%`b=AhKYZCiFr!((#q7DM4i%bgqg#w?{NhWvz diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..63c9405 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: ๐Ÿš€ Publish +on: + push: + branches: + - main +jobs: + publish_job: + name: '๐Ÿš€ Publish' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“ฅ Checkout repository + uses: actions/checkout@v2 + - name: ๐Ÿงฑ Setup node + uses: actions/setup-node@v2 + with: + node-version: '16' + - name: ๐Ÿ“ฆ Install packages + run: npm install + - name: ๐Ÿ— Build assets + run: npm run build + - name: ๐Ÿš€ Publish to production + uses: fission-suite/publish-action@v1 + with: + machine_key: ${{ secrets.FISSION_MACHINE_KEY }} + app_url: webnative-template.fission.app + build_dir: ./build diff --git a/README.md b/README.md index 5ebf03b..a5bae40 100644 --- a/README.md +++ b/README.md @@ -110,15 +110,8 @@ Check out the [Webnative Guide](https://guide.fission.codes/developers/webnative ## ๐Ÿงจ Deploy -The [Webnative App Template demo](https://webnative.netlify.app) is currently hosted on Netlify, but it should be supported on any static hosting platform (Vercel, Cloudflare Pages, etc). -### Fission App Hosting - -Coming soon! - -_You can't currently deploy to Fission's app hosting infrastructure._ SvelteKit Single-Page Applications require redirects in order to support routing. Redirects are not currently supported by IPFS, so the [Fission Publish GitHub action](https://github.com/fission-codes/publish-action) is not yet supported. - -There is [work underway to extend IPFS http gateways to support redirects](https://github.com/ipfs/kubo/pull/8890). Once that is merged, deploying to Fission will work. +The Webnative App Template is currently deployed as a [Netlify app](https://webnative.netlify.app) and a [Fission app](https://webnative-template.fission.app), but it should be supported on any static hosting platform (Vercel, Cloudflare Pages, etc). ### Netlify @@ -127,6 +120,29 @@ In order to deploy your Webnative application on Netlify: 1. Create a new Netlify site and connect your app's git repository. (If you don't have your application stored in a git repository, you can upload the output of a [static build](#static-build).) 2. Netlify takes care of the rest. No Netlify-specific configuration is needed. 3. There is no step 3. +### Fission App Hosting + +A Webnative application can be published to IPFS with the [Fission CLI](https://guide.fission.codes/developers/cli) or the [Fission GitHub publish action](https://github.com/fission-suite/publish-action). + +To publish with the Fission CLI: + +1. [Install the CLI](https://guide.fission.codes/developers/installation) +2. Run `fission setup` to make a Fission account +3. Run `npm run build` to build the app +4. Delete `fission.yaml` +5. Run `fission app register` to register a new Fission app (accept the `./build` directory suggestion for your build directory) +6. Run `fission app publish` to publish your app to the web + +Your app will be available online at the domain assigned by the register command. + +To set up the GitHub publish action: + +1. Register the app with the CLI +2. Export your machine key with `base64 ~/.config/fission/key/machine_id.ed25519` +3. Add your machine key as a GH Repository secret named `FISSION_MACHINE_KEY` +4. Update the `publish.yml` with the name of your registered app + +See the [Fission Guide](https://guide.fission.codes/developers/installation) and the publish action README for more details. ### Static Build diff --git a/fission.yaml b/fission.yaml new file mode 100644 index 0000000..270f717 --- /dev/null +++ b/fission.yaml @@ -0,0 +1,3 @@ +ignore: [] +url: webnative-template.fission.app +build: ./build \ No newline at end of file diff --git a/src/components/Header.svelte b/src/components/Header.svelte index 5744bc6..7af49f0 100644 --- a/src/components/Header.svelte +++ b/src/components/Header.svelte @@ -31,7 +31,7 @@ {#if !$sessionStore.loading && $sessionStore.backupCreated === false} goto('delegate-account')} + on:click={() => goto('/delegate-account')} class="btn btn-sm h-10 btn-warning rounded-full font-normal transition-colors ease-in hover:bg-orange-500 hover:border-orange-500" > diff --git a/src/components/auth/backup/AreYouSure.svelte b/src/components/auth/backup/AreYouSure.svelte index 15dac28..99efe45 100644 --- a/src/components/auth/backup/AreYouSure.svelte +++ b/src/components/auth/backup/AreYouSure.svelte @@ -28,7 +28,10 @@ Without a backup device, if you lose this device or reset your browser, you will not be able to recover your account data.

- -