Skip to content

Commit 9c6f9af

Browse files
feat: Adapt to v5 (#189)
* feat: Adapt to v5 * fix: Fix permissions * use 5.0.0-rc.1 tag * fix: address PR review on strategy config and upstream version Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 4d4518b commit 9c6f9af

15 files changed

Lines changed: 418 additions & 185 deletions

‎.github/workflows/bump.yml‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Bump packages
2+
on:
3+
repository_dispatch:
4+
types: [bump]
5+
workflow_dispatch:
6+
inputs:
7+
hoprd_version:
8+
description: 'Version of hoprd to build'
9+
required: false
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
bump:
15+
name: Bump docker images
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
25+
- name: Set up Docker Compose
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y docker-compose
29+
- name: Setup variables
30+
id: setup
31+
run: |
32+
default_hoprd_version=$(yq -r '.services.node.build.args.UPSTREAM_VERSION' docker-compose.yml)
33+
default_hoprd_version=$(echo $default_hoprd_version | cut -d@ -f1)
34+
hoprd_version="${HOPRD_VERSION:-$default_hoprd_version}"
35+
docker pull "${DOCKER_REGISTRY}/hoprd:${hoprd_version#v}"
36+
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "${DOCKER_REGISTRY}/hoprd:${hoprd_version#v}" | cut -d@ -f2)
37+
echo "HOPRD_VERSION=${hoprd_version}@${digest}" | tee -a "${GITHUB_OUTPUT}"
38+
39+
env:
40+
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }}
41+
HOPRD_VERSION: ${{ github.event.inputs.hoprd_version || github.event.client_payload.hoprd_version }}
42+
- name: Update docker-compose.yml
43+
run: |
44+
yq -i '.services.node.build.args.UPSTREAM_VERSION = strenv(HOPRD_VERSION)' docker-compose.yml
45+
env:
46+
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }}
47+
HOPRD_VERSION: ${{ steps.setup.outputs.HOPRD_VERSION }}
48+
- name: Install dependencies
49+
run: |
50+
npm install
51+
- name: Build
52+
run: |
53+
npx @dappnode/dappnodesdk build \
54+
--provider "remote" \
55+
--verbose | tee build.log
56+
- name: Create Pull Request
57+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
58+
with:
59+
commit-message: "ci: Update docker images"
60+
title: "ci: Update docker images"
61+
body: "This pull request updates the docker images to:\n- hoprd: ${{ steps.setup.outputs.HOPRD_VERSION }}\n\nThis PR was automatically generated by the bump workflow."
62+
branch: bot/update-${{ github.run_id}}
63+
delete-branch: true
64+
assignees: ${{ github.actor }}
65+
reviewers: "ausias-armesto,tolbrino,NumberFour8,Teebor-Choka,QYuQianchen,jeandemeusy,majchrzamemil,Jaguaras,mjadach-iv"

‎.github/workflows/main.yml‎

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

‎.github/workflows/merge.yaml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
publish-ipfs:
12+
name: Publish merged build to IPFS
13+
if: github.event.pull_request.merged == true
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.pull_request.base.ref }}
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Set up Docker Compose
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y docker-compose
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Build and upload to IPFS
33+
run: |
34+
npx @dappnode/dappnodesdk build \
35+
--provider "remote" \
36+
--verbose | tee build.log
37+
38+
ipfs_hash=$(grep -oP 'Release hash *: \K/ipfs/\w+' build.log)
39+
40+
echo "### DNP (DAppNode Package) built and uploaded" >> "$GITHUB_STEP_SUMMARY"
41+
echo "Merged build published to IPFS: \`${ipfs_hash}\`" >> "$GITHUB_STEP_SUMMARY"

‎.github/workflows/pr.yaml‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled]
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
test:
11+
name: Test package
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Validate hoprd.cfg.yaml
18+
run: ./test/validate-hoprd-config.sh
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Set up Docker Compose
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y docker-compose
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Build package (validate manifest and compose file)
32+
run: npx @dappnode/dappnodesdk build --skip_upload --verbose
33+
34+
publish-ipfs:
35+
name: Publish test build to IPFS
36+
needs: test
37+
if: contains(github.event.pull_request.labels.*.name, 'publish-ipfs')
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Set up Docker Compose
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y docker-compose
50+
51+
- name: Install dependencies
52+
run: npm ci
53+
54+
- name: Build and upload to IPFS
55+
run: |
56+
npx @dappnode/dappnodesdk build \
57+
--provider "remote" \
58+
--verbose | tee build.log
59+
60+
ipfs_hash=$(grep -oP 'Release hash *: \K/ipfs/\w+' build.log)
61+
62+
echo "### DNP (DAppNode Package) built and uploaded" >> "$GITHUB_STEP_SUMMARY"
63+
echo "Test build published to IPFS: \`${ipfs_hash}\`" >> "$GITHUB_STEP_SUMMARY"

‎.github/workflows/release.yaml‎

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: Version type for this release
8+
required: true
9+
type: choice
10+
default: "patch"
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
concurrency:
17+
group: release
18+
cancel-in-progress: false
19+
20+
jobs:
21+
release:
22+
name: Release
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write
26+
env:
27+
# `secrets` isn't a valid context inside `if:` (only env/github/inputs/... are) - see
28+
# the "Notify Zulip" step below, which needs these to decide whether to run at all.
29+
ZULIP_EMAIL: ${{ secrets.ZULIP_EMAIL }}
30+
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Set up Docker Compose
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y docker-compose
44+
45+
- name: Install dependencies
46+
run: npm ci
47+
48+
- name: Generate release notes
49+
uses: hoprnet/hopr-workflows/actions/generate-release-notes@c20a995078b3a9a66ae9e6689d08d38ea37b5a0b # generate-release-notes-v1.0.1
50+
with:
51+
source_branch: ${{ github.ref_name }}
52+
format: github
53+
release_notes_file: ./release-notes.md
54+
55+
- name: Add release notes to summary
56+
run: |
57+
echo "### Release notes" >> "$GITHUB_STEP_SUMMARY"
58+
cat release-notes.md >> "$GITHUB_STEP_SUMMARY"
59+
60+
- name: Build and publish to package repository
61+
id: publish
62+
run: |
63+
npx @dappnode/dappnodesdk publish "${{ inputs.release_type }}" \
64+
--provider "remote" \
65+
--upload_to "ipfs" \
66+
--verbose \
67+
--github_release | tee build.log
68+
69+
new_version=$(jq -r '.version' dappnode_package.json)
70+
ipfs_hash=$(grep -oP 'Release hash *: \K/ipfs/\w+' build.log)
71+
72+
echo "### DNP (DAppNode Package) built and uploaded" >> "$GITHUB_STEP_SUMMARY"
73+
echo "- Version: \`${new_version}\`" >> "$GITHUB_STEP_SUMMARY"
74+
echo "- IPFS Hash: \`${ipfs_hash}\`" >> "$GITHUB_STEP_SUMMARY"
75+
76+
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
77+
echo "ipfs_hash=$ipfs_hash" >> "$GITHUB_OUTPUT"
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
DEVELOPER_ADDRESS: "0x7305356ad936A06c4ea5DF45AD5E5C3ff9Db818E"
81+
82+
- name: Add release notes to the Github release
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
run: |
86+
tag="v${{ steps.publish.outputs.new_version }}"
87+
gh release edit "$tag" --repo "${{ github.repository }}" --notes-file release-notes.md
88+
89+
- name: Notify Zulip
90+
if: ${{ env.ZULIP_EMAIL != '' && env.ZULIP_API_KEY != '' }}
91+
uses: zulip/github-actions-zulip/send-message@v1
92+
with:
93+
api-key: ${{ env.ZULIP_API_KEY }}
94+
email: ${{ env.ZULIP_EMAIL }}
95+
organization-url: "https://hopr.zulipchat.com"
96+
type: "stream"
97+
to: HOPRd
98+
topic: Releases
99+
content: |
100+
A new hoprd dAppNode package version v${{ steps.publish.outputs.new_version }} is available.
101+
- IPFS Hash: ${{ steps.publish.outputs.ipfs_hash }}
102+
Access your dAppNode and check for updates.

‎.github/workflows/release.yml‎

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

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
/.direnv
77

88
# Node.js
9-
/node_modules/
9+
/node_modules/
10+
11+
build.log

0 commit comments

Comments
 (0)