-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 1.87 KB
/
github-actions-demo.yaml
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
name: Publish portfolio on IPFS
run-name: Build Zola portfolio and publish it on IPFS
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Zola
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Check out repository code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Building zola project
run: zola build
- name: making all relative
run: |
cd public
npx all-relative
cd ..
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: vesla0x1-portfolio
path: public
deploy:
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- name: Docker pull
run: |
docker pull ipfs/kubo:latest
- name: Start the container
run: |
mkdir /tmp/ipfsin
mkdir /tmp/ipfsout
docker run -d --name ipfs_host -v /tmp/ipfsin/:/export -v /tmp/ipfsout/:/data/ipfs -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/kubo:latest
- name: Download build files
uses: actions/download-artifact@v4
with:
name: vesla0x1-portfolio
path: public
- name: Add build files to IPFS
run: |
cp -r public /tmp/ipfsin/public
docker exec ipfs_host ipfs add -r /export/public > /data/ipfs/out
- name: check output
run: cat /tmp/ipfsout/out
- name: Pin by CID
run: |
API_URL=https://api.pinata.cloud/pinning/pinByHash
CID=asdf
curl -X POST -H "content-type: application/json" \
-H "Bearer: ${{ secrets.PINATA_API_SECRET }}" -d "{\"hashToPin\": \"$CID\"}" $API_URL