Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: migrate from CircleCI to GitHub Actions #137

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .circleci/config.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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
path: build
- run: ls -la build
- env:
CIRCLE_PROJECT_USERNAME: ipfs-shipyard
CIRCLE_PROJECT_REPONAME: ipfs-share-files
CIRCLE_SHA1: ${{ github.sha }}
CLUSTER_USER: ${{ secrets.CLUSTER_USER }}
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }}
GITHUB_TOKEN: ${{ github.token }}
BUILD_DIR: build
SCRIPT: |
set -e
set -o pipefail
set -x

apk add --no-cache jq curl

pin_name="$CIRCLE_PROJECT_REPONAME $BUILD_DIR $GITHUB_RUN_ID"

hash=$(pin-to-cluster.sh "$pin_name" $BUILD_DIR)

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 \
-w /tmp \
-e GITHUB_TOKEN \
-e GITHUB_RUN_ID \
-e GITHUB_REF_NAME \
-e CIRCLE_PROJECT_USERNAME \
-e CIRCLE_PROJECT_REPONAME \
-e CIRCLE_SHA1 \
-e CLUSTER_USER \
-e CLUSTER_PASSWORD \
-e BUILD_DIR \
ipfs-dns-deploy \
bash -c "$SCRIPT"
Loading