Skip to content

Build Zola portfolio and publish it on IPFS #35

Build Zola portfolio and publish it on IPFS

Build Zola portfolio and publish it on IPFS #35

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 > out &&
docker exec ipfs_host ls data/ipfs -al
- 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