Skip to content

Commit

Permalink
ci: migrate from CircleCI to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Jul 30, 2024
1 parent b502247 commit ff5ba35
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 49 deletions.
49 changes: 0 additions & 49 deletions .circleci/config.yml

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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: '10.*'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
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 dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: ls -la dist
- env:
CIRCLE_PROJECT_USERNAME: ipfs-shipyard
CIRCLE_PROJECT_REPONAME: ipfs-block-party
CIRCLE_SHA1: ${{ github.sha }}
CLUSTER_USER: ${{ secrets.CLUSTER_USER }}
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }}
GITHUB_TOKEN: ${{ github.token }}
BUILD_DIR: dist
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
if [ "$GITHUB_REF_NAME" == "master" ] ; then
dnslink-dnsimple -d blocks.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"

0 comments on commit ff5ba35

Please sign in to comment.