Skip to content
Open
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
65 changes: 65 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Bump packages
on:
repository_dispatch:
types: [bump]
workflow_dispatch:
inputs:
hoprd_version:
description: 'Version of hoprd to build'
required: false
permissions:
contents: read

jobs:
bump:
name: Bump docker images
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Setup variables
id: setup
run: |
default_hoprd_version=$(yq -r '.services.node.build.args.UPSTREAM_VERSION' docker-compose.yml)
default_hoprd_version=$(echo $default_hoprd_version | cut -d@ -f1)
hoprd_version="${HOPRD_VERSION:-$default_hoprd_version}"
docker pull "${DOCKER_REGISTRY}/hoprd:${hoprd_version#v}"
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "${DOCKER_REGISTRY}/hoprd:${hoprd_version#v}" | cut -d@ -f2)
echo "HOPRD_VERSION=${hoprd_version}@${digest}" | tee -a "${GITHUB_OUTPUT}"

env:
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }}
HOPRD_VERSION: ${{ github.event.inputs.hoprd_version || github.event.client_payload.hoprd_version }}
- name: Update docker-compose.yml
run: |
yq -i '.services.node.build.args.UPSTREAM_VERSION = strenv(HOPRD_VERSION)' docker-compose.yml
env:
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }}
HOPRD_VERSION: ${{ steps.setup.outputs.HOPRD_VERSION }}
- name: Install dependencies
run: |
npm install
- name: Build
run: |
npx @dappnode/dappnodesdk build \
--provider "remote" \
--verbose | tee build.log
- name: Create Pull Request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
commit-message: "ci: Update docker images"
title: "ci: Update docker images"
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."
branch: bot/update-${{ github.run_id}}
delete-branch: true
assignees: ${{ github.actor }}
reviewers: "ausias-armesto,tolbrino,NumberFour8,Teebor-Choka,QYuQianchen,jeandemeusy,majchrzamemil,Jaguaras,mjadach-iv"
32 changes: 0 additions & 32 deletions .github/workflows/main.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Merge

on:
pull_request:
types: [closed]

permissions:
contents: read

jobs:
publish-ipfs:
name: Publish merged build to IPFS
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Install dependencies
run: npm ci

- name: Build and upload to IPFS
run: |
npx @dappnode/dappnodesdk build \
--provider "remote" \
--verbose | tee build.log

ipfs_hash=$(grep -oP 'Release hash *: \K/ipfs/\w+' build.log)

echo "### DNP (DAppNode Package) built and uploaded" >> "$GITHUB_STEP_SUMMARY"
echo "Merged build published to IPFS: \`${ipfs_hash}\`" >> "$GITHUB_STEP_SUMMARY"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
63 changes: 63 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PR

on:
pull_request:
types: [opened, synchronize, reopened, labeled]
permissions:
contents: read

jobs:
test:
name: Test package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate hoprd.cfg.yaml
run: ./test/validate-hoprd-config.sh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Install dependencies
run: npm ci

- name: Build package (validate manifest and compose file)
run: npx @dappnode/dappnodesdk build --skip_upload --verbose

publish-ipfs:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
name: Publish test build to IPFS
needs: test
if: contains(github.event.pull_request.labels.*.name, 'publish-ipfs')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Install dependencies
run: npm ci

- name: Build and upload to IPFS
run: |
npx @dappnode/dappnodesdk build \
--provider "remote" \
--verbose | tee build.log

ipfs_hash=$(grep -oP 'Release hash *: \K/ipfs/\w+' build.log)

echo "### DNP (DAppNode Package) built and uploaded" >> "$GITHUB_STEP_SUMMARY"
echo "Test build published to IPFS: \`${ipfs_hash}\`" >> "$GITHUB_STEP_SUMMARY"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
102 changes: 102 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release

on:
workflow_dispatch:
inputs:
release_type:
description: Version type for this release
required: true
type: choice
default: "patch"
options:
- patch
- minor
- major

concurrency:
group: release
cancel-in-progress: false

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
env:
# `secrets` isn't a valid context inside `if:` (only env/github/inputs/... are) - see
# the "Notify Zulip" step below, which needs these to decide whether to run at all.
ZULIP_EMAIL: ${{ secrets.ZULIP_EMAIL }}
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Install dependencies
run: npm ci

- name: Generate release notes
uses: hoprnet/hopr-workflows/actions/generate-release-notes@c20a995078b3a9a66ae9e6689d08d38ea37b5a0b # generate-release-notes-v1.0.1
with:
source_branch: ${{ github.ref_name }}
format: github
release_notes_file: ./release-notes.md

- name: Add release notes to summary
run: |
echo "### Release notes" >> "$GITHUB_STEP_SUMMARY"
cat release-notes.md >> "$GITHUB_STEP_SUMMARY"

- name: Build and publish to package repository
id: publish
run: |
npx @dappnode/dappnodesdk publish "${{ inputs.release_type }}" \
--provider "remote" \
--upload_to "ipfs" \
--verbose \
--github_release | tee build.log

new_version=$(jq -r '.version' dappnode_package.json)
ipfs_hash=$(grep -oP 'Release hash *: \K/ipfs/\w+' build.log)

echo "### DNP (DAppNode Package) built and uploaded" >> "$GITHUB_STEP_SUMMARY"
echo "- Version: \`${new_version}\`" >> "$GITHUB_STEP_SUMMARY"
echo "- IPFS Hash: \`${ipfs_hash}\`" >> "$GITHUB_STEP_SUMMARY"

echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
echo "ipfs_hash=$ipfs_hash" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEVELOPER_ADDRESS: "0x7305356ad936A06c4ea5DF45AD5E5C3ff9Db818E"

- name: Add release notes to the Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="v${{ steps.publish.outputs.new_version }}"
gh release edit "$tag" --repo "${{ github.repository }}" --notes-file release-notes.md

- name: Notify Zulip
if: ${{ env.ZULIP_EMAIL != '' && env.ZULIP_API_KEY != '' }}
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ env.ZULIP_API_KEY }}
email: ${{ env.ZULIP_EMAIL }}
organization-url: "https://hopr.zulipchat.com"
type: "stream"
to: HOPRd
topic: Releases
content: |
A new hoprd dAppNode package version v${{ steps.publish.outputs.new_version }} is available.
- IPFS Hash: ${{ steps.publish.outputs.ipfs_hash }}
Access your dAppNode and check for updates.
53 changes: 0 additions & 53 deletions .github/workflows/release.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
/.direnv

# Node.js
/node_modules/
/node_modules/

build.log
Loading
Loading