Skip to content

Commit 047a59b

Browse files
committed
ci: migrate from CircleCI to GitHub Actions
1 parent b502247 commit 047a59b

File tree

2 files changed

+81
-49
lines changed

2 files changed

+81
-49
lines changed

.circleci/config.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/build-deploy.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build and Deploy to IPFS
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- github-actions
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '10.*'
22+
- run: npm ci
23+
- run: npm run build
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: dist
27+
path: dist
28+
deploy:
29+
if: github.event_name == 'push'
30+
needs: [build]
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
repository: ipfs-shipyard/ipfs-dns-deploy
36+
- name: Download dist
37+
uses: actions/download-artifact@v4
38+
with:
39+
name: dist
40+
path: dist
41+
- run: ls -la dist
42+
- env:
43+
CIRCLE_PROJECT_USERNAME: ipfs-shipyard
44+
CIRCLE_PROJECT_REPONAME: ipfs-block-party
45+
CIRCLE_SHA1: ${{ github.sha }}
46+
CLUSTER_USER: ${{ secrets.CLUSTER_USER }}
47+
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }}
48+
GITHUB_TOKEN: ${{ github.token }}
49+
BUILD_DIR: dist
50+
SCRIPT: |
51+
set -e
52+
set -o pipefail
53+
set -x
54+
55+
apk add --no-cache jq curl
56+
57+
pin_name="$CIRCLE_PROJECT_REPONAME $BUILD_DIR $GITHUB_RUN_ID"
58+
59+
hash=$(pin-to-cluster.sh "$pin_name" $BUILD_DIR)
60+
61+
echo "Website added to IPFS: https://dweb.link/ipfs/$hash"
62+
63+
# Update DNSlink
64+
if [ "$GITHUB_REF_NAME" == "master" ] ; then
65+
dnslink-dnsimple -d blocks.ipfs.io -r _dnslink -l /ipfs/$hash
66+
fi
67+
run: |
68+
docker build -t ipfs-dns-deploy .
69+
docker run --rm -v $PWD:/tmp \
70+
-w /tmp \
71+
-e GITHUB_TOKEN \
72+
-e GITHUB_RUN_ID \
73+
-e GITHUB_REF_NAME \
74+
-e CIRCLE_PROJECT_USERNAME \
75+
-e CIRCLE_PROJECT_REPONAME \
76+
-e CIRCLE_SHA1 \
77+
-e CLUSTER_USER \
78+
-e CLUSTER_PASSWORD \
79+
-e BUILD_DIR \
80+
ipfs-dns-deploy \
81+
bash -c "$SCRIPT"

0 commit comments

Comments
 (0)