Skip to content

Commit 0373d4a

Browse files
olizillaAlan Shaw
authored andcommitted
feat: pin site to ipfs on PR (#2)
License: MIT Signed-off-by: Oli Evans <[email protected]>
1 parent 25dafc9 commit 0373d4a

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

.circleci/config.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/node:10.15.1-browsers
6+
environment:
7+
NO_SANDBOX: true
8+
steps:
9+
- checkout
10+
- run:
11+
command: npm ci
12+
- run:
13+
command: npm run lint
14+
- run:
15+
command: npm run build
16+
- persist_to_workspace:
17+
root: .
18+
paths:
19+
- dist
20+
21+
deploy:
22+
docker:
23+
- image: olizilla/ipfs-dns-deploy:latest
24+
environment:
25+
DOMAIN: dag.ipfs.io
26+
BUILD_DIR: dist
27+
steps:
28+
- attach_workspace:
29+
at: /tmp/workspace
30+
- run:
31+
name: Deploy website to IPFS
32+
command: |
33+
pin_name="$DOMAIN build $CIRCLE_BUILD_NUMBER"
34+
35+
hash=$(pin-to-cluster.sh "$pin_name" /tmp/workspace/$BUILD_DIR)
36+
37+
echo "Website added to IPFS: https://ipfs.io/ipfs/$hash"
38+
39+
# no domain yet.
40+
# if [ "$CIRCLE_BRANCH" == "master" ] ; then
41+
# dnslink-dnsimple -d $DOMAIN -r _dnslink -l /ipfs/$hash
42+
# fi
43+
44+
workflows:
45+
version: 2
46+
build-deploy:
47+
jobs:
48+
- build
49+
- deploy:
50+
context: ipfs-dns-deploy
51+
requires:
52+
- build

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"scripts": {
1818
"start": "parcel src/index.html",
19-
"build": "parcel build src/index.html"
19+
"build": "parcel build src/index.html",
20+
"lint": "standard"
2021
},
2122
"keywords": [],
2223
"author": "",

0 commit comments

Comments
 (0)