-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.73 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
name: Publish portfolio on IPFS
run-name: Build Zola portfolio and publish it on IPFS
on: push
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
env:
CIDS_FILE_PATH: '/tmp/cids'
PINATA_PIN_NAME: ${{ vars.PINATA_PIN_NAME }}
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: Deploy on IPFS
run: |
cd .deploy && npm install .
mv ../public .
node ipfs_deploy.js
env:
IPFS_RPC_API_URL: ${{ vars.IPFS_RPC_API_URL }}
IPFS_RPC_API_SECRET: ${{ vars.IPFS_RPC_API_SECRET }}
IPFS_RPC_API_NAME_KEY: ${{ vars.IPFS_RPC_API_NAME_KEY }}
- name: Unpin old and pin new versions on Pinata
run: |
UNPIN_CID=$(cat $CIDS_FILE_PATH | head -n 1)
PIN_CID=$(cat $CIDS_FILE_PATH | tail -n 1)
curl -X POST \
-H "Authorization: Bearer ${{ secrets.PINATA_API_KEY }}" \
-H 'Content-type: application/json' \
-d "{
\"hashToPin\": \"$PIN_CID\",
\"pinataMetadata\": \"{\\\"name\\\": \\\"$PINATA_PIN_NAME\\\"}\"
}" \
https://api.pinata.cloud/pinning/pinByHash
curl -X DELETE \
-H "Authorization: Bearer ${{ secrets.PINATA_API_KEY }}" \
https://api.pinata.cloud/pinning/unpin/$UNPIN_CID