Skip to content

ci: migrate from CircleCI to GitHub Actions #4

ci: migrate from CircleCI to GitHub Actions

ci: migrate from CircleCI to GitHub Actions #4

Workflow file for this run

name: Build and Deploy to IPFS
on:
pull_request:
push:
branches:
- main
- production
- github-actions
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '14.*'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: build
path: build
deploy:
if: github.event_name == 'push'
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ipfs-shipyard/ipfs-dns-deploy
- name: Download build
uses: actions/download-artifact@v4
with:
name: build
- env:
SCRIPT: |
pin_name="ipfs-share-files build ${{ github.run_id }}"
hash=$(pin-to-cluster.sh "$pin_name" build)
echo "Website added to IPFS: https://dweb.link/ipfs/$hash"
# Update DNSlink for prod or dev domain
if [ "${{ github.ref_name }}" == "production" ] ; then
dnslink-dnsimple -d share.ipfs.io -r _dnslink -l /ipfs/$hash
fi
if [ "${{ github.ref_name }}" == "main" ] ; then
dnslink-dnsimple -d dev.share.ipfs.io -r _dnslink -l /ipfs/$hash
fi
run: |
docker build -t ipfs-dns-deploy .
docker run --rm -v $PWD:/tmp ipfs-dns-deploy bash -c "$SCRIPT"