@@ -112,20 +112,52 @@ jobs:
112
112
113
113
# pin the built site to ipfs-websites cluster, output the cid as `steps.ipfs.outputs.cid`
114
114
# see: https://github.com/ipfs-shipyard/ipfs-github-action
115
- -
uses :
ipfs-shipyard/[email protected]
116
- id : ipfs
115
+ - uses : ipfs/download-ipfs-distribution-action@v1
117
116
with :
118
- path_to_add : build
119
- cluster_host : /dnsaddr/ipfs-websites.collab.ipfscluster.io
120
- cluster_user : ${{ secrets.CLUSTER_USER }}
121
- cluster_password : ${{ secrets.CLUSTER_PASSWORD }}
122
- env :
123
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
124
- GODEBUG : netdns=go
117
+ name : go-ipfs
118
+ - uses : ipfs/download-ipfs-distribution-action@v1
119
+ with :
120
+ name : ipfs-cluster-ctl
121
+ - name : Fix DNS resolver
122
+ run : |
123
+ # fix resolv - DNS provided by Github is unreliable for DNSLik/dnsaddr
124
+ sudo sed -i -e 's/nameserver 127.0.0.*/nameserver 1.1.1.1/g' /etc/resolv.conf
125
+
126
+ - uses : ipfs/start-ipfs-daemon-action@v1
127
+ - name : Import build/ to IPFS
128
+ id : ipfs
129
+ run : |
130
+ root_cid=$(ipfs add --cid-version 1 -Q -r ./build)
131
+ echo "::set-output name=cid::$root_cid"
125
132
126
- - run : echo ${{ steps.ipfs.outputs.url }}
133
+ - run : echo ${{ steps.ipfs.outputs.cid }}
127
134
- run : echo ${{ github.ref }}
128
135
136
+ - name : Pin to ipfs-websites.collab.ipfscluster.io
137
+ run : |
138
+ ipfs-cluster-ctl --enc=json \
139
+ --host "${CLUSTER_HOST}" \
140
+ --basic-auth "$CLUSTER_USER:$CLUSTER_PASSWORD" \
141
+ peers ls > cluster-peers-ls
142
+ for maddr in $(jq -r '.[].ipfs.addresses[]?' cluster-peers-ls); do
143
+ ipfs swarm peering add $maddr &
144
+ ipfs swarm connect $maddr &
145
+ done
146
+ ipfs-cluster-ctl --enc=json \
147
+ --host "${CLUSTER_HOST}" \
148
+ --basic-auth "${CLUSTER_USER}:${CLUSTER_PASSWORD}" \
149
+ pin add \
150
+ --name "${PIN_NAME}" \
151
+ --replication-min 1 \
152
+ --wait \
153
+ $PIN_CID
154
+ env :
155
+ CLUSTER_HOST : " /dnsaddr/ipfs-websites.collab.ipfscluster.io"
156
+ CLUSTER_USER : ${{ secrets.CLUSTER_USER }}
157
+ CLUSTER_PASSWORD : ${{ secrets.CLUSTER_PASSWORD }}
158
+ PIN_CID : ${{ steps.ipfs.outputs.cid }}
159
+ PIN_NAME : " ipfs-webui@${{ github.sha }}"
160
+
129
161
# dev dnslink is updated on each main branch update
130
162
- run : npx dnslink-dnsimple --domain dev.webui.ipfs.io --link /ipfs/${{ steps.ipfs.outputs.cid }}
131
163
if : github.ref == 'refs/heads/main'
0 commit comments