Skip to content
Merged
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
54 changes: 54 additions & 0 deletions .github/workflows/dappnode-build-hash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: DAppNode Build Hash

on:
workflow_call:
inputs:
all_variants:
description: "Build all package variants defined in the repo"
required: false
type: boolean
default: false
variants:
description: "Comma-separated list of variants to build (e.g. 'gnosis,mainnet,hoodi')"
required: false
type: string
default: ""
secrets:
PINATA_API_KEY:
required: true
PINATA_SECRET_API_KEY:
required: true

jobs:
build-hash:
runs-on: ubuntu-latest
name: Build and post IPFS hash
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v4
with:
node-version: "24"

- name: Build and pin to IPFS, post PR comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}
INPUT_ALL_VARIANTS: ${{ inputs.all_variants }}
INPUT_VARIANTS: ${{ inputs.variants }}
run: |
set -euo pipefail

args=(github-action build)
if [ "${INPUT_ALL_VARIANTS}" = "true" ]; then
args+=(--all_variants)
fi
if [ -n "${INPUT_VARIANTS:-}" ]; then
args+=(--variant "${INPUT_VARIANTS}")
fi

npx @dappnode/dappnodesdk "${args[@]}"
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Centralized reusable GitHub Actions workflows for the DAppNode organization.
| [`staking-sync-test.yml`](.github/workflows/staking-sync-test.yml) | Sync test on PRs | All staking packages |
| [`sync-production.yml`](.github/workflows/sync-production.yml) | Daily production sync + Discord notification | EL packages |
| [`onchain-release-sync.yml`](.github/workflows/onchain-release-sync.yml) | Sync release metadata with on-chain published hashes | Packages that use tropibot onchain sync |
| [`dappnode-build-hash.yml`](.github/workflows/dappnode-build-hash.yml) | Build on PR / push, pin to IPFS, post IPFS hash comment on the PR | All DAppNode packages |
| [`notify-discord.yml`](.github/workflows/notify-discord.yml) | Discord failure notifications | Internal (called by sync-production) |

## Usage
Expand Down Expand Up @@ -177,6 +178,55 @@ jobs:
secrets: inherit
```

### Build Hash (PR / push)

Builds the package on every push and PR, pins the result to IPFS via Pinata, and
posts a comment with the install link on the triggering PR. Run on any non-`main` /
non-`master` branch push (tropibot bump branches qualify) plus on PRs for fast feedback.

```yaml
name: Build
on:
workflow_dispatch:
pull_request:
push:
paths-ignore: ["README.md"]
jobs:
build:
uses: dappnode/workflows/.github/workflows/dappnode-build-hash.yml@master
secrets: inherit
```

For packages that publish multiple variants (e.g. `gnosis`, `mainnet`, `hoodi`):

```yaml
jobs:
build:
uses: dappnode/workflows/.github/workflows/dappnode-build-hash.yml@master
with:
all_variants: true
secrets: inherit
```

Or pick a specific subset:

```yaml
jobs:
build:
uses: dappnode/workflows/.github/workflows/dappnode-build-hash.yml@master
with:
variants: "gnosis,mainnet,hoodi"
secrets: inherit
```

Notes:
- The workflow auto-detects the GitHub event; on `push` to a non-default branch it
builds + pins to Pinata and comments the PR, on `pull_request` it runs a
`--skip_save` build only.
- The caller must have `PINATA_API_KEY` and `PINATA_SECRET_API_KEY` available as
repository or org-level secrets (use `secrets: inherit`).


## Packages Using These Workflows

### Execution Clients
Expand Down