Skip to content

Commit 4789810

Browse files
feat: Refactor workflows (#11)
* feat: Refactor workflows * split install dependencies in its own step
1 parent 352f1da commit 4789810

8 files changed

Lines changed: 164 additions & 94 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version_type:
7+
required: true
8+
type: string
9+
description: "The type of version bump (commit, pr, release)"
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
20+
- name: Set up Docker Compose
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y docker-compose
24+
- name: Install dependencies
25+
run: |
26+
npm install
27+
- name: Build
28+
if: inputs.version_type == 'commit'
29+
run: |
30+
npx @dappnode/dappnodesdk build \
31+
--provider "remote" \
32+
--verbose | tee build.log
33+
- name: Build and publish
34+
if: inputs.version_type == 'pr' || inputs.version_type == 'release'
35+
run: |
36+
npx @dappnode/dappnodesdk publish patch \
37+
--provider "remote" \
38+
--upload_to "ipfs" \
39+
--verbose \
40+
--github_release | tee build.log
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
DEVELOPER_ADDRESS: "0x7305356ad936A06c4ea5DF45AD5E5C3ff9Db818E"
44+
- name: Summarize build output
45+
id: summarize
46+
run: |
47+
grep "ipfs" build.log >> $GITHUB_STEP_SUMMARY
48+
ipfs_hash=$(grep -oP 'Release hash : \K/ipfs/\w+' build.log)
49+
- name: Send message to Zulip
50+
if: inputs.version_type == 'release'
51+
uses: zulip/github-actions-zulip/send-message@v1
52+
with:
53+
api-key: ${{ secrets.ZULIP_API_KEY }}
54+
email: ${{ secrets.ZULIP_EMAIL }}
55+
organization-url: "https://hopr.zulipchat.com"
56+
type: "stream"
57+
to: "HOPRd"
58+
topic: "Releases"
59+
content: |
60+
A new hoprd dAppNode package (rotsee) version is available.
61+
- IPFS Hash: ${{ steps.summarize.outputs.ipfs_hash }}
62+
Access to your dAppNode and check for the updates
63+
echo "ipfs_hash=$ipfs_hash" | tee -a $GITHUB_OUTPUT

‎.github/workflows/bump.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Bump packages
2+
3+
on:
4+
repository_dispatch:
5+
types: [release]
6+
workflow_dispatch:
7+
inputs:
8+
hoprd_version:
9+
description: 'Version of hoprd to build'
10+
required: false
11+
node_admin_version:
12+
description: 'Version of node-admin to build'
13+
required: false
14+
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
24+
- name: Set up Docker Compose
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y docker-compose
28+
- name: Setup variables
29+
id: setup
30+
run: |
31+
default_hoprd_version=$(yq -r '.services.hoprd.build.args.UPSTREAM_VERSION' docker-compose.yml)
32+
node_admin_image=$(yq -r '.services.admin.image' docker-compose.yml)
33+
default_node_admin_version=$(echo $node_admin_image | cut -d: -f2)
34+
echo "HOPRD_VERSION=${HOPRD_VERSION:-$default_hoprd_version}" | tee -a "${GITHUB_OUTPUT}"
35+
echo "NODE_ADMIN_VERSION=${NODE_ADMIN_VERSION:-$default_node_admin_version}" | tee -a "${GITHUB_OUTPUT}"
36+
env:
37+
HOPRD_VERSION: ${{ github.event.inputs.hoprd_version || github.event.client_payload.hoprd_version }}
38+
NODE_ADMIN_VERSION: ${{ github.event.inputs.node_admin_version || github.event.client_payload.node_admin_version }}
39+
- name: Update docker-compose.yml
40+
run: |
41+
yq -i '.services.hoprd.build.args.UPSTREAM_VERSION = strenv(HOPRD_VERSION)' docker-compose.yml
42+
yq -i '.services.admin.image = "europe-west3-docker.pkg.dev/hoprassociation/docker-images/hopr-admin:" + strenv(NODE_ADMIN_VERSION)' docker-compose.yml
43+
env:
44+
HOPRD_VERSION: ${{ steps.setup.outputs.HOPRD_VERSION }}
45+
NODE_ADMIN_VERSION: ${{ steps.setup.outputs.NODE_ADMIN_VERSION }}
46+
- name: Install dependencies
47+
run: |
48+
npm install
49+
- name: Build
50+
run: |
51+
npx @dappnode/dappnodesdk build \
52+
--provider "remote" \
53+
--verbose | tee build.log
54+
- name: Commit bumped versions
55+
uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0
56+
with:
57+
add: docker-compose.yml
58+
new_branch: ${{ github.ref_name }}
59+
message: "ci: Bump docker images"
60+
pathspec_error_handling: ignore
61+
default_author: user_info
62+
github_token: ${{ secrets.github_token }}

‎.github/workflows/main.yml‎

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

‎.github/workflows/merge.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Merge
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
jobs:
7+
build:
8+
name: Build
9+
if: github.event.pull_request.merged == true
10+
uses: ./.github/workflows/build.yml
11+
with:
12+
version_type: pr

‎.github/workflows/pr.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: PR
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- ready_for_review
9+
jobs:
10+
build:
11+
name: Build
12+
uses: ./.github/workflows/build.yml
13+
with:
14+
version_type: commit

‎.github/workflows/release.yml‎

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,12 @@
11
name: Build (release package)
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
5+
workflow_dispatch:
76

87
jobs:
98
build:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout repository
13-
uses: actions/checkout@v4
14-
15-
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v2
17-
18-
- name: Set up Docker Compose
19-
run: |
20-
sudo apt-get update
21-
sudo apt-get install -y docker-compose
22-
23-
- name: Build and publish to package repository
24-
id: publish
25-
run: |
26-
npm install
27-
npx @dappnode/dappnodesdk publish patch \
28-
--provider "remote" \
29-
--upload_to "ipfs" \
30-
--verbose \
31-
--github_release | tee build.log
32-
33-
echo "DNP (DAppNode Package) built and uploaded" >> $GITHUB_STEP_SUMMARY
34-
grep "ipfs" build.log >> $GITHUB_STEP_SUMMARY
35-
ipfs_hash=$(grep -oP 'Release hash : \K/ipfs/\w+' build.log)
36-
echo "ipfs_hash=$ipfs_hash" >> $GITHUB_OUTPUT
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
DEVELOPER_ADDRESS: "0x7305356ad936A06c4ea5DF45AD5E5C3ff9Db818E"
40-
41-
- name: Send message to Zulip
42-
uses: zulip/github-actions-zulip/send-message@v1
43-
with:
44-
api-key: ${{ secrets.ZULIP_API_KEY }}
45-
email: ${{ secrets.ZULIP_EMAIL }}
46-
organization-url: "https://hopr.zulipchat.com"
47-
type: "stream"
48-
to: "HOPRd"
49-
topic: "Releases"
50-
content: |
51-
A new hoprd dAppNode package (rotsee) version is available.
52-
- IPFS Hash: ${{ steps.publish.outputs.ipfs_hash }}
53-
Access to your dAppNode and check for the updates
9+
name: Build
10+
uses: ./.github/workflows/build.yml
11+
with:
12+
version_type: release

‎docker-compose.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
build:
66
context: .
77
args:
8-
UPSTREAM_VERSION: 3.0.0@sha256:fa9764f5e9927094960f63dfb68dbf6cbc237210559a890f1effa29da6e92ecd
8+
UPSTREAM_VERSION: 4.0.0-rc.3@sha256:81a866d276c37ec7db2a66d31b4fb30dee26143a4cf5a0a9c59078d8c99b42d8
99
ports:
1010
- "3101:3101/tcp"
1111
- 9191:9191/tcp

‎setup-wizard.yml‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,17 @@ fields:
2727
*or* if you plan to expose your REST API (port 3101) or HOPR Admin UI (port 3100) to the public.
2828
secret: true
2929

30-
- id: HOPRD_PROVIDER
30+
- id: HOPRD_BLOKLI_URL
3131
target:
3232
type: environment
33-
name: HOPRD_PROVIDER
33+
name: HOPRD_BLOKLI_URL
3434
service: node
35-
title: RPC Provider URL
35+
title: Blokli URL
3636
required: false
3737
description: |-
38-
URL to the custom RPC provider this HOPR node should use. Supports simple query strings.
39-
If your DAppnode is running a Gnosis Chain RPC endpoint, it is **strongly recommended** to use it here.
38+
URL to the Blokli provider this HOPR node should use.
4039
41-
*Example:* `http://nethermind-xdai.dappnode:8545`
40+
*Example:* `https://blokli.rotsee.hoprnet.link`
4241
secret: false
4342
# Regular expression for matching URLs with simple query strings
4443
#
@@ -53,14 +52,7 @@ fields:
5352
# - (:[0-9]{2,5})? : Optional port number (10-99999)
5453
# Examples: :80, :8080, :44300
5554
#
56-
# - (/[a-z0-9.-/_]*)? : Optional URL path
57-
# Allows: slashes, lowercase letters, numbers, dots, hyphens, underscores
58-
# Examples: /path, /path/to/resource, /api/v1/endpoint
59-
#
60-
# - (\?[a-z0-9._=&-]*)? : Optional query string
61-
# Allows: lowercase letters, numbers, dots, underscores, equals signs, ampersands, hyphens
62-
# Examples: ?param=value, ?id=123&type=test, ?user.name=john_doe
63-
pattern: ^http[s]{0,1}:\/\/[a-z0-9.-]{3,}(:[0-9]{2,5})?(\/[a-z0-9.-/_]*)?(\?[a-z0-9._=&-]*)?$
55+
pattern: ^http[s]{0,1}:\/\/[a-z0-9.-]{3,}(:[0-9]{2,5})?$
6456
patternErrorMessage: Must be a valid url starting with `http://` or `https://`
6557

6658
# - id: IDENTITY

0 commit comments

Comments
 (0)