-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (65 loc) · 3.09 KB
/
swarm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: push to swarm
### run this action when something is pushed to master branch
on:
push:
branches: [ master ]
schedule:
- cron: '9 9 1,15 * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 1 # Increment this number if you need to re-download cached gems
- run: bundle exec jekyll build --baseurl "" --destination ./dist # defaults output to '/_site'
### upload the content of public folder to swarm
- name: Upload
id: swarm-upload
uses: ethersphere/swarm-actions/upload-dir@latest
with:
# Fairdatasociety provides a free endpoint for uploading content to swarm
# use .dev. for testnet uploads
# or remove .dev. for mainnet uploads
# or use your own private endpoint
bee-url: https://gateway.fairdatasociety.org/proxy/
dir: ./dist
index-document: index.html
timeout: 120000
pin: true
- name: update feed
id: swarm-feed
uses: ethersphere/swarm-actions/write-feed@latest
with:
# Same as above regarding bee-url
bee-url: https://gateway.fairdatasociety.org/proxy/
# takes the reference from the uploaded dir
reference: ${{ steps.swarm-upload.outputs.reference }}
# make up some topic name
# for example: # openssl rand -hex 16
topic: a022076ed9689fb041476a4f60ab7153
# signer you will want to put into your projects secrets
# again use some random hex 32 length generation
# for example: openssl rand -hex 32 and put the output into gihub secrets named "SIGNER"
# https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository
signer: ${{ secrets.SIGNER }}
# print some references of what we just uploaded to swarm
- name: print references
run: |
echo "upload ref: " ${{ steps.swarm-upload.outputs.reference }} # you can use this to access the content directly https://gateway.dev.fairdatasociety.org/bzz/<refrence>
echo "CID: " ${{ steps.swarm-cid.outputs.cid }} # same but in cid format
echo "Feed Manifest: " ${{ steps.swarm-feed.outputs.manifest }} # note this reference, you will need this in next step to create a persistant reference to it using ENS
- name: purge cache
env:
TOKEN: '${{ secrets.purge_token }}'
DEPLOYMENT: .
PURGE_URL: 'https://fairos.staging.fairdatasociety.org'
run: |
curl -s ${{ env.PURGE_URL }}/deploy/purge?token=${{ secrets.purge_token }} -H "site: fairdataprotocol.link{{ env.DEPLOYMENT }}fairdatasociety.org" -H "uri: "