-
Notifications
You must be signed in to change notification settings - Fork 0
1587 lines (1354 loc) · 75.6 KB
/
Copy pathpublish.yml
File metadata and controls
1587 lines (1354 loc) · 75.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Create and publish a Docker image
# Configures this workflow to run on signed release tags for both node and helm releases
on:
push:
tags:
- 'fennel-node-*' # run for node release tags
- 'helm-fennel-node-*' # run for helm chart release tags
workflow_dispatch:
inputs:
rebuild_release:
description: 'Rebuild release artifacts for existing tag'
required: false
type: boolean
default: true
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# NOTE: Bootnode configurations are now dynamically generated from GitHub secrets
# to prevent peer ID collisions and follow external-only bootnode architecture
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: write # Changed from read to write to allow pushing commits
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for tag verification
fetch-tags: true # Explicitly fetch all tags
ref: ${{ github.ref }} # Ensure we check out the exact ref that triggered the workflow
# Ensure tag objects are properly fetched (GitHub Actions sometimes fetches only refs)
- name: Refetch tag objects
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "🔄 Ensuring tag object is available for: $TAG"
# Force refetch the tag with its object
git fetch origin "refs/tags/$TAG:refs/tags/$TAG" --force
# Verify we now have the tag object
echo "📋 Post-fetch verification:"
echo " Tag type: $(git cat-file -t "refs/tags/$TAG" 2>/dev/null || echo 'unknown')"
echo " Tag hash: $(git rev-parse "refs/tags/$TAG" 2>/dev/null || echo 'unknown')"
echo " Commit hash: $(git rev-parse "refs/tags/$TAG^{commit}" 2>/dev/null || echo 'unknown')"
# They should be different for annotated tags
TAG_HASH=$(git rev-parse "refs/tags/$TAG" 2>/dev/null || echo '')
COMMIT_HASH=$(git rev-parse "refs/tags/$TAG^{commit}" 2>/dev/null || echo '')
if [ "$TAG_HASH" != "$COMMIT_HASH" ] && [ -n "$TAG_HASH" ] && [ -n "$COMMIT_HASH" ]; then
echo "✅ Annotated tag object successfully fetched"
else
echo "⚠️ Tag object may not be properly fetched, attempting alternative fetch..."
# Try fetching all tag objects
git fetch origin '+refs/tags/*:refs/tags/*' --force
# Re-verify
NEW_TAG_HASH=$(git rev-parse "refs/tags/$TAG" 2>/dev/null || echo '')
NEW_COMMIT_HASH=$(git rev-parse "refs/tags/$TAG^{commit}" 2>/dev/null || echo '')
echo " After alternative fetch - Tag: $NEW_TAG_HASH, Commit: $NEW_COMMIT_HASH"
fi
# Verify tag signature for release builds
- name: Verify tag signature
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "🔐 Verifying signature for tag: $TAG"
# Import the trusted public key
gpg --import .github/release-signing.pub.asc
# Basic validation that this is a proper release tag
if [[ ! "$TAG" =~ ^fennel-node-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid tag format. Expected: fennel-node-X.Y.Z"
exit 1
fi
# Ensure the tag exists and is available locally
echo "🔍 Checking if tag exists locally..."
if ! git tag -l | grep -q "^$TAG$"; then
echo "⚠️ Tag not found locally, fetching..."
git fetch origin "refs/tags/$TAG:refs/tags/$TAG"
fi
# Verify tag object type and show debugging info
echo "🔍 Debugging tag object..."
# Check different ways to reference the tag
echo " Tag type (direct): $(git cat-file -t "$TAG" 2>/dev/null || echo 'unknown')"
echo " Tag type (refs/tags): $(git cat-file -t "refs/tags/$TAG" 2>/dev/null || echo 'unknown')"
echo " Tag exists in local refs: $(git tag -l | grep "^$TAG$" || echo 'NOT FOUND')"
# Determine the correct tag reference to use
TAG_REF="$TAG"
if git cat-file -t "refs/tags/$TAG" 2>/dev/null | grep -q "tag"; then
TAG_REF="refs/tags/$TAG"
echo " Using full ref: $TAG_REF"
elif git cat-file -t "$TAG" 2>/dev/null | grep -q "tag"; then
echo " Using short ref: $TAG_REF"
else
echo "⚠️ Warning: Tag reference resolves to commit, trying explicit refs..."
# List all possible tag references
echo " Available tag refs:"
git for-each-ref refs/tags/ --format="%(refname) -> %(objecttype)" | grep "$TAG" || echo " No matching tag refs found"
# Try to find the actual tag object
if git show-ref --tags | grep -q "refs/tags/$TAG$"; then
TAG_REF="refs/tags/$TAG"
echo " Found explicit tag ref: $TAG_REF"
fi
fi
# Show tag information for debugging
echo "📋 Tag object information (using $TAG_REF):"
if git cat-file -t "$TAG_REF" 2>/dev/null | grep -q "tag"; then
echo "✅ Found tag object, showing tag info:"
git cat-file tag "$TAG_REF" | head -10
else
echo "⚠️ Not a tag object, showing commit info:"
git show --no-patch --format=" Commit: %H%n Author: %an <%ae>%n Date: %ai%n Subject: %s" "$TAG_REF"
fi
# Verify the tag signature using the correct reference
echo "🔐 Attempting tag signature verification (using $TAG_REF)..."
if git verify-tag "$TAG_REF" 2>&1; then
echo "✅ Tag signature verified successfully"
else
echo "❌ Tag signature verification failed"
echo "🔍 Debugging tag verification issue..."
# Show detailed git information
echo " Git ref information:"
git show-ref | grep "$TAG" || echo " No refs found for $TAG"
echo " Tag object details:"
git for-each-ref refs/tags/ --format="%(refname) %(objecttype) %(objectname)" | grep "$TAG" || echo " No tag object found"
# Try alternative verification approaches
echo " Trying alternative verification methods..."
# Method 1: Direct tag object verification
if git show-ref --tags | grep -q "refs/tags/$TAG$"; then
echo " Method 1: Using explicit refs/tags/$TAG"
git verify-tag "refs/tags/$TAG" --verbose 2>&1 || echo " Failed"
fi
# Method 2: Check if it's an annotated tag
COMMIT_HASH=$(git rev-parse "$TAG^{commit}" 2>/dev/null || echo "")
TAG_HASH=$(git rev-parse "$TAG" 2>/dev/null || echo "")
echo " Commit hash: $COMMIT_HASH"
echo " Tag hash: $TAG_HASH"
if [ "$COMMIT_HASH" != "$TAG_HASH" ]; then
echo " Tag is annotated (hashes differ), should be verifiable"
else
echo " Tag appears to be lightweight (hashes same), cannot verify signature"
fi
exit 1
fi
# Free up additional disk space on GitHub runner (~20-25 GB)
# Enhanced cleanup for Polkadot SDK builds without cache
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
with:
android: true # 12 GB save
dotnet: true # 3 GB save
haskell: true # 2 GB save
large-packages: true # 4 GB save
docker-images: true # 10 GB save - remove unused docker images
swap-storage: false # Keep swap for large builds
# Set up Docker Buildx for efficient layer caching
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Set up QEMU for ARM64 emulation
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
# ------------------------------------------------------------
# BOOTNODE PEER ID CONFIGURATION
# Use public bootnode peer IDs from GitHub secrets
# ------------------------------------------------------------
- name: Configure bootnode peer IDs
run: |
set -euo pipefail
echo "🔐 Configuring bootnode peer IDs from GitHub secrets..."
# Get public bootnode peer IDs from GitHub secrets
PEER1="${{ secrets.BOOTNODE1_PEER_ID }}"
PEER2="${{ secrets.BOOTNODE2_PEER_ID }}"
# Verify peer IDs are set
if [ -z "$PEER1" ] || [ -z "$PEER2" ]; then
echo "❌ ERROR: Bootnode peer IDs are missing from GitHub secrets!"
echo "🔧 Add BOOTNODE1_PEER_ID and BOOTNODE2_PEER_ID to GitHub repository settings"
echo "💡 These are public peer IDs (not private keys) - safe to store in GitHub Secrets"
exit 1
fi
# Build JSON array for bootnodes
BOOTNODES_JSON=$(jq -cn --arg id1 "$PEER1" --arg id2 "$PEER2" '
[
"/dns4/bootnode1.fennel.network/tcp/30333/p2p/\($id1)",
"/dns4/bootnode2.fennel.network/tcp/30333/p2p/\($id2)"
]')
# Set environment variables for subsequent steps
echo "EXTERNAL_BOOTNODES_JSON=$BOOTNODES_JSON" >> $GITHUB_ENV
echo "BOOTNODE1_PEER_ID=$PEER1" >> $GITHUB_ENV
echo "BOOTNODE2_PEER_ID=$PEER2" >> $GITHUB_ENV
# Log success
echo "✅ Successfully configured bootnode peer IDs from GitHub secrets"
echo "🌐 Using external-only bootnode architecture (following Parity best practices)"
echo "🌐 Bootnode 1 Peer ID: $PEER1"
echo "🌐 Bootnode 2 Peer ID: $PEER2"
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=long
labels: |
org.opencontainers.image.title=Fennel Node
org.opencontainers.image.description=A Substrate-based blockchain node for the Fennel network with enhanced security and cryptographic verification
org.opencontainers.image.vendor=Fennel Network
org.opencontainers.image.licenses=Apache-2.0
# ------------------------------------------------------------
# PRODUCTION KEY EXPORT (using GitHub Secrets)
# Export public keys for production builds - MANDATORY for releases
# Public keys are safe to store in GitHub Secrets, private keys remain in Vault
# ------------------------------------------------------------
- name: Export production public keys from GitHub Secrets
env:
PROD_SUDO_SS58: ${{ secrets.PROD_SUDO_SS58 }}
PROD_VAL1_AURA_PUB: ${{ secrets.PROD_VAL1_AURA_PUB }}
PROD_VAL1_GRANDPA_PUB: ${{ secrets.PROD_VAL1_GRANDPA_PUB }}
PROD_VAL1_STASH_SS58: ${{ secrets.PROD_VAL1_STASH_SS58 }}
PROD_VAL2_AURA_PUB: ${{ secrets.PROD_VAL2_AURA_PUB }}
PROD_VAL2_GRANDPA_PUB: ${{ secrets.PROD_VAL2_GRANDPA_PUB }}
PROD_VAL2_STASH_SS58: ${{ secrets.PROD_VAL2_STASH_SS58 }}
run: |
set -euo pipefail
echo "🔐 Setting up production environment variables from GitHub Secrets..."
# For production releases, use real keys from GitHub Secrets
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "🏭 Production release detected - exporting production keys from GitHub Secrets"
# MANDATORY production keys - build will fail if any are missing
# GitHub Actions pulls public values from GitHub Secrets,
# exports them as environment variables, and Rust compiler substitutes them
# into the preset at build time via env!() macros
echo "🔑 Exporting production public keys from GitHub Secrets..."
# Debug: Check if secrets are available
echo "🔍 Debugging secret availability..."
echo "PROD_SUDO_SS58 is set: ${PROD_SUDO_SS58+yes}"
echo "PROD_SUDO_SS58 length: ${#PROD_SUDO_SS58}"
echo "PROD_SUDO_SS58 value: '${PROD_SUDO_SS58:-EMPTY}'"
# Export production keys from GitHub Secrets (now available as env vars)
export SUDO_SS58="${PROD_SUDO_SS58}"
export VAL1_AURA_PUB="${PROD_VAL1_AURA_PUB}"
export VAL1_GRANDPA_PUB="${PROD_VAL1_GRANDPA_PUB}"
export VAL1_STASH_SS58="${PROD_VAL1_STASH_SS58}"
export VAL2_AURA_PUB="${PROD_VAL2_AURA_PUB}"
export VAL2_GRANDPA_PUB="${PROD_VAL2_GRANDPA_PUB}"
export VAL2_STASH_SS58="${PROD_VAL2_STASH_SS58}"
# Verify all production variables are set (prevent empty values)
for var in SUDO_SS58 VAL1_AURA_PUB VAL1_GRANDPA_PUB VAL1_STASH_SS58 VAL2_AURA_PUB VAL2_GRANDPA_PUB VAL2_STASH_SS58; do
if [ -z "${!var:-}" ]; then
echo "❌ ERROR: Production variable $var is empty or missing from GitHub Secrets!"
echo "🔧 Add PROD_* secrets to GitHub repository settings"
echo "💡 Use extract-github-secrets.sh script to get the required values"
exit 1
fi
done
echo "✅ All 7 production environment variables exported from GitHub Secrets and validated"
echo "🔒 Using production public keys from GitHub Secrets (private keys remain secure in Vault)"
else
echo "🧪 Development/staging build - production variables not required"
echo "📋 Development/staging presets use Alice/Bob hardcoded keys from sp_keyring"
echo "⚠️ Production environment variables will NOT be set for non-release builds"
echo "🛡️ This is intentional - development uses different preset logic"
fi
# ------------------------------------------------------------
# Build the runtime deterministically with srtool and capture
# its SHA-256 so we can inject it as an OCI label.
# ------------------------------------------------------------
- name: Build runtime with srtool & extract Wasm hash
id: wasm
env:
PROD_SUDO_SS58: ${{ secrets.PROD_SUDO_SS58 }}
PROD_VAL1_AURA_PUB: ${{ secrets.PROD_VAL1_AURA_PUB }}
PROD_VAL1_GRANDPA_PUB: ${{ secrets.PROD_VAL1_GRANDPA_PUB }}
PROD_VAL1_STASH_SS58: ${{ secrets.PROD_VAL1_STASH_SS58 }}
PROD_VAL2_AURA_PUB: ${{ secrets.PROD_VAL2_AURA_PUB }}
PROD_VAL2_GRANDPA_PUB: ${{ secrets.PROD_VAL2_GRANDPA_PUB }}
PROD_VAL2_STASH_SS58: ${{ secrets.PROD_VAL2_STASH_SS58 }}
run: |
set -euo pipefail
echo "🛠️ Running srtool to build compact runtime…"
# Build command with conditional environment variables
# For production releases: pass mandatory environment variables
# For development/staging: build without production env vars (uses Alice/Bob presets)
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "🏭 Building production runtime with GitHub Secrets-sourced public keys"
# Debug: Verify environment variables before passing to Docker
echo "🔍 Environment variables being passed to srtool:"
echo "SUDO_SS58 length: ${#PROD_SUDO_SS58}"
echo "VAL1_AURA_PUB length: ${#PROD_VAL1_AURA_PUB}"
echo "VAL1_GRANDPA_PUB length: ${#PROD_VAL1_GRANDPA_PUB}"
echo "VAL1_STASH_SS58 length: ${#PROD_VAL1_STASH_SS58}"
echo "VAL2_AURA_PUB length: ${#PROD_VAL2_AURA_PUB}"
echo "VAL2_GRANDPA_PUB length: ${#PROD_VAL2_GRANDPA_PUB}"
echo "VAL2_STASH_SS58 length: ${#PROD_VAL2_STASH_SS58}"
# Production build with mandatory environment variables
# These MUST be set or build.rs will fail with clear error message
docker run --rm \
-v "${PWD}":/build \
-e RUNTIME_DIR=runtime/fennel \
-e PACKAGE=fennel-node-runtime \
-e SUDO_SS58="${PROD_SUDO_SS58}" \
-e VAL1_AURA_PUB="${PROD_VAL1_AURA_PUB}" \
-e VAL1_GRANDPA_PUB="${PROD_VAL1_GRANDPA_PUB}" \
-e VAL1_STASH_SS58="${PROD_VAL1_STASH_SS58}" \
-e VAL2_AURA_PUB="${PROD_VAL2_AURA_PUB}" \
-e VAL2_GRANDPA_PUB="${PROD_VAL2_GRANDPA_PUB}" \
-e VAL2_STASH_SS58="${PROD_VAL2_STASH_SS58}" \
--workdir /build \
paritytech/srtool:1.84.1
else
echo "🧪 Building development/staging runtime (no production env vars needed)"
# Development/staging build without production environment variables
# build.rs will NOT enforce mandatory variables for non-production builds
docker run --rm \
-v "${PWD}":/build \
-e RUNTIME_DIR=runtime/fennel \
-e PACKAGE=fennel-node-runtime \
--workdir /build \
paritytech/srtool:1.84.1
fi
# After the container exits the compiled Wasm lives in the mounted volume
HASH=$(sha256sum runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm | awk '{print "0x"$1}')
echo "WASM_HASH=$HASH" >> $GITHUB_ENV
echo "hash=$HASH" >> $GITHUB_OUTPUT
echo "✅ Deterministic Wasm hash: $HASH"
# ------------------------------------------------------------
# Build Fennel node binary from source (canonical Parity-style)
# Uses paritytech/ci-unified:latest - Parity's official CI image
# Contains all Rust toolchains, build dependencies, and tools
# ------------------------------------------------------------
- name: Cache cargo build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build fennel node using Parity CI Unified image
if: startsWith(github.ref, 'refs/tags/fennel-node-') || !startsWith(github.ref, 'refs/tags/')
id: build_node
env:
PROD_SUDO_SS58: ${{ secrets.PROD_SUDO_SS58 }}
PROD_VAL1_AURA_PUB: ${{ secrets.PROD_VAL1_AURA_PUB }}
PROD_VAL1_GRANDPA_PUB: ${{ secrets.PROD_VAL1_GRANDPA_PUB }}
PROD_VAL1_STASH_SS58: ${{ secrets.PROD_VAL1_STASH_SS58 }}
PROD_VAL2_AURA_PUB: ${{ secrets.PROD_VAL2_AURA_PUB }}
PROD_VAL2_GRANDPA_PUB: ${{ secrets.PROD_VAL2_GRANDPA_PUB }}
PROD_VAL2_STASH_SS58: ${{ secrets.PROD_VAL2_STASH_SS58 }}
run: |
set -euo pipefail
echo "🔧 Building fennel node using Parity CI Unified image..."
# Export production environment variables for release builds
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "🏭 Building production node with GitHub Secrets-sourced public keys"
export SUDO_SS58="${PROD_SUDO_SS58}"
export VAL1_AURA_PUB="${PROD_VAL1_AURA_PUB}"
export VAL1_GRANDPA_PUB="${PROD_VAL1_GRANDPA_PUB}"
export VAL1_STASH_SS58="${PROD_VAL1_STASH_SS58}"
export VAL2_AURA_PUB="${PROD_VAL2_AURA_PUB}"
export VAL2_GRANDPA_PUB="${PROD_VAL2_GRANDPA_PUB}"
export VAL2_STASH_SS58="${PROD_VAL2_STASH_SS58}"
else
echo "🧪 Building development/staging node (no production env vars needed)"
fi
# Use Parity's CI Unified image for building (canonical Parity practice)
docker run --rm \
-v "${PWD}":/build \
-e SUDO_SS58="${SUDO_SS58:-}" \
-e VAL1_AURA_PUB="${VAL1_AURA_PUB:-}" \
-e VAL1_GRANDPA_PUB="${VAL1_GRANDPA_PUB:-}" \
-e VAL1_STASH_SS58="${VAL1_STASH_SS58:-}" \
-e VAL2_AURA_PUB="${VAL2_AURA_PUB:-}" \
-e VAL2_GRANDPA_PUB="${VAL2_GRANDPA_PUB:-}" \
-e VAL2_STASH_SS58="${VAL2_STASH_SS58:-}" \
--workdir /build \
paritytech/ci-unified:latest \
bash -c "
# Add target for cross-compilation (Parity standard)
rustup target add x86_64-unknown-linux-gnu
# Build with Parity's recommended flags
cargo build --locked --release --target x86_64-unknown-linux-gnu -p fennel-node
# Create distribution directory and install binary
mkdir -p dist
install -Dm0755 target/x86_64-unknown-linux-gnu/release/fennel-node dist/fennel-node
# Verify binary works
./dist/fennel-node --version
"
echo "✅ fennel-node built and staged in dist/"
# Clean up build artifacts after copying binary
echo "🧹 Cleaning up build artifacts to free space..."
rm -rf target/x86_64-unknown-linux-gnu/release/deps || true
rm -rf target/x86_64-unknown-linux-gnu/release/build || true
rm -rf target/x86_64-unknown-linux-gnu/release/.fingerprint || true
rm -rf target/x86_64-unknown-linux-gnu/release/incremental || true
find target -type f -name "*.rlib" -delete || true
find target -type f -name "*.rmeta" -delete || true
echo "✅ Build artifacts cleaned"
- name: Package fennel node tarball
id: pkg_node
run: |
set -euo pipefail
VER="${GITHUB_REF_NAME}" # e.g. fennel-node-0.5.7
# Remove the fennel-node- prefix from version if it exists
VERSION_ONLY="${VER#fennel-node-}" # This strips the prefix, resulting in just "0.5.7"
OUT="fennel-node-${VERSION_ONLY}-linux-x86_64.tar.gz"
mkdir -p artifacts-node
tar -czf "artifacts-node/${OUT}" -C dist fennel-node
TARBALL_HASH=$(sha256sum "artifacts-node/${OUT}" | awk '{print $1}')
echo "tarball=artifacts-node/${OUT}" >> "$GITHUB_OUTPUT"
echo "sha256=$TARBALL_HASH" >> "$GITHUB_OUTPUT"
# 👉 Ansible-ready format (<algo>:<hash>)
echo "ansible_checksum=sha256:${TARBALL_HASH}" >> "$GITHUB_OUTPUT"
# Still generate the .sha256 file for compatibility
echo "$TARBALL_HASH ${OUT}" > "artifacts-node/${OUT}.sha256"
echo "✅ Node tarball packaged: artifacts-node/${OUT}"
echo "✅ Ansible checksum: sha256:${TARBALL_HASH}"
- name: Prepare raw binary for Parity Ansible
id: raw_binary
run: |
set -euo pipefail
cp dist/fennel-node artifacts-node/fennel-node-linux-x86_64
chmod 0755 artifacts-node/fennel-node-linux-x86_64
RAW_HASH=$(sha256sum artifacts-node/fennel-node-linux-x86_64 | awk '{print $1}')
echo "binary=artifacts-node/fennel-node-linux-x86_64" >> "$GITHUB_OUTPUT"
echo "binary_sha256=artifacts-node/fennel-node-linux-x86_64.sha256" >> "$GITHUB_OUTPUT"
echo "sha256=$RAW_HASH" >> "$GITHUB_OUTPUT"
# 👉 Ansible-ready format (<algo>:<hash>)
echo "ansible_checksum=sha256:${RAW_HASH}" >> "$GITHUB_OUTPUT"
# Still generate the .sha256 file for compatibility
echo "$RAW_HASH fennel-node-linux-x86_64" > artifacts-node/fennel-node-linux-x86_64.sha256
echo "✅ Raw binary prepared: artifacts-node/fennel-node-linux-x86_64"
echo "✅ Ansible checksum: sha256:${RAW_HASH}"
# Clean up srtool build artifacts to free disk space
- name: Clean up srtool artifacts
run: |
echo "=== Cleaning up srtool build artifacts ==="
# Remove intermediate build files but keep the final WASM
find runtime/fennel/target/srtool -type f -name "*.rlib" -delete || true
find runtime/fennel/target/srtool -type f -name "*.rmeta" -delete || true
find runtime/fennel/target/srtool -type d -name "deps" -exec rm -rf {} + || true
find runtime/fennel/target/srtool -type d -name "build" -exec rm -rf {} + || true
# Additional aggressive cleanup
echo "=== Additional cleanup ==="
# Remove Docker build cache and unused images
docker system prune -af --volumes || true
# Remove temporary files
sudo rm -rf /tmp/* || true
# Remove apt cache
sudo apt-get clean || true
# Remove package manager caches
sudo rm -rf /var/cache/apt/archives/* || true
sudo rm -rf /var/lib/apt/lists/* || true
# Remove journal logs
sudo journalctl --vacuum-time=1s || true
echo "=== Disk usage after cleanup ==="
df -h
# ------------------------------------------------------------
# Generate chain specifications using chain-spec-builder
# ------------------------------------------------------------
- name: Install jq for JSON processing
run: |
sudo apt-get update && sudo apt-get install -y jq
echo "✅ Installed jq"
- name: Install chain-spec-builder using Parity CI Unified image
run: |
# Create directory for chain-spec-builder
mkdir -p "${HOME}/.cargo/bin"
# Use Parity's CI Unified image for installation (canonical Parity practice)
docker run --rm \
-v "${PWD}":/build \
-v "${HOME}/.cargo/bin":/cargo-bin \
--workdir /build \
paritytech/ci-unified:latest \
bash -c "
# Install chain-spec-builder with Parity's recommended approach
cargo install staging-chain-spec-builder --locked --root /tmp/cargo-install
cp /tmp/cargo-install/bin/chain-spec-builder /cargo-bin/
# Verify installation
/cargo-bin/chain-spec-builder --version || echo 'Version check not available'
"
echo "✅ Installed chain-spec-builder using Parity CI Unified image"
# Add cargo bin to PATH for subsequent steps
echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
- name: Create development chain spec
run: |
set -euo pipefail
# Create development directory in chainspecs if it doesn't exist
mkdir -p chainspecs/development
# Debug: Check chain-spec-builder version and help
echo "Chain-spec-builder version:"
chain-spec-builder --version || echo "No version flag available"
echo -e "\nChain-spec-builder help:"
chain-spec-builder --help || echo "No help available"
echo -e "\nChain-spec-builder create help:"
chain-spec-builder create --help || echo "No create help available"
# Check if the runtime has a development preset
echo "Checking available presets..."
chain-spec-builder list-presets \
--runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm || true
# Check if runtime exists
echo "Checking if runtime WASM exists..."
ls -la runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm || echo "Runtime WASM not found!"
# Generate development chain spec
echo "Creating development chain spec..."
chain-spec-builder \
-c chainspecs/development/development.json \
create \
-r runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
named-preset development
# Convert to raw format
echo "Converting to raw format..."
chain-spec-builder \
-c chainspecs/development/development-raw.json \
convert-to-raw \
chainspecs/development/development.json
# Verify the specs were created
echo "✅ Generated chain specifications:"
ls -l chainspecs/development/
# Quick verification of content
echo "Verifying development.json content:"
jq '.name' chainspecs/development/development.json || echo "Failed to parse JSON"
# Comprehensive verification
echo -e "\n📋 Verification of generated files:"
ls -l chainspecs/development/development.json chainspecs/development/development-raw.json
echo -e "\n📄 Chain spec structure (first 5 lines):"
jq . chainspecs/development/development.json 2>/dev/null | head -n 5 || true
echo -e "\n🔍 Checking file sizes:"
stat -c "development.json: %s bytes" chainspecs/development/development.json
stat -c "development-raw.json: %s bytes" chainspecs/development/development-raw.json
# Verify raw spec is SCALE-encoded (not JSON)
echo -e "\n🔬 Verifying raw spec format (first 200 bytes):"
head -c 200 chainspecs/development/development-raw.json | xxd | head -n 5 || echo "Could not read raw spec"
# Ensure files are not empty
if [ ! -s chainspecs/development/development.json ]; then
echo "❌ Error: development.json is empty!"
exit 1
fi
if [ ! -s chainspecs/development/development-raw.json ]; then
echo "❌ Error: development-raw.json is empty!"
exit 1
fi
echo "✅ All development chain spec files are populated"
- name: Inject bootnodes into development chain spec
run: |
set -euo pipefail
echo "🔗 Injecting bootnode peer IDs into development chain spec..."
TARGET="development"
SPEC="chainspecs/${TARGET}/development.json"
# Use external-only bootnodes (Parity's recommended approach)
# Both internal and external nodes use the same public endpoints
# Use bootnodes JSON directly (peer IDs are public and safe to log)
EXTERNAL_BOOTNODES="$EXTERNAL_BOOTNODES_JSON"
echo "📋 Using external-only bootnode architecture:"
# Only update if there are actual changes needed (idempotent)
CURRENT_BOOTNODES=$(jq -c '.bootNodes // []' "$SPEC")
CURRENT_PROTOCOL=$(jq -r '.protocolId // ""' "$SPEC")
CURRENT_SS58=$(jq -r '.properties.ss58Format // ""' "$SPEC")
CURRENT_DECIMALS=$(jq -r '.properties.tokenDecimals // ""' "$SPEC")
CURRENT_SYMBOL=$(jq -r '.properties.tokenSymbol // ""' "$SPEC")
if [ "$CURRENT_BOOTNODES" != "$EXTERNAL_BOOTNODES" ] || \
[ "$CURRENT_PROTOCOL" != "fenn" ] || \
[ "$CURRENT_SS58" != "42" ] || \
[ "$CURRENT_DECIMALS" != "12" ] || \
[ "$CURRENT_SYMBOL" != "FNL" ]; then
echo "📝 Updating bootNodes in ${TARGET} chain spec with peer IDs and chain metadata..."
jq --argjson arr "$EXTERNAL_BOOTNODES" \
--arg ss58 "42" \
'.bootNodes = $arr
| .protocolId = "fenn"
| .properties = {
"ss58Format": ($ss58|tonumber),
"tokenDecimals": 12,
"tokenSymbol": "FNL"
}' "$SPEC" > tmp.json && mv tmp.json "$SPEC"
# Regenerate raw spec with bootnodes included
echo "🔄 Regenerating raw ${TARGET} spec with bootnodes..."
chain-spec-builder \
-c "chainspecs/${TARGET}/development-raw.json" \
convert-to-raw \
"chainspecs/${TARGET}/development.json"
echo "✅ Bootnodes updated successfully with peer IDs"
else
echo "✅ No changes needed - bootnodes already up to date"
fi
# Verify bootnodes configuration
echo "📊 Current bootNodes configuration:"
jq '.bootNodes' "$SPEC" || echo "No bootNodes found"
- name: Commit development chainspecs to repository
run: |
# Configure git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Add the development chainspecs
git add chainspecs/development/development.json chainspecs/development/development-raw.json
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to development chainspecs"
else
# Commit the changes with [ci skip] to prevent retriggering
git commit -m "Update development chainspecs with bootnode peer IDs [ci skip]
- Peer IDs from GitHub secrets (BOOTNODE1_PEER_ID, BOOTNODE2_PEER_ID)
- Using external-only bootnode architecture (Parity best practice)
- Bootnode 1: $BOOTNODE1_PEER_ID
- Bootnode 2: $BOOTNODE2_PEER_ID"
# Fetch latest main and rebase our changes on top
git fetch origin main
git rebase origin/main
# Push the changes back to the repository (push current HEAD to main branch)
git push origin HEAD:main
echo "✅ Development chainspecs committed and pushed to repository"
fi
- name: Create staging chain specs
run: |
set -euo pipefail
# Create staging directory in chainspecs if it doesn't exist
mkdir -p chainspecs/staging
# Generate staging chain spec
echo "Generating staging chain spec..."
chain-spec-builder \
-c chainspecs/staging/staging-chainspec.json \
create \
-r runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
named-preset staging
# Generate raw staging chain spec
echo "Generating raw staging chain spec..."
chain-spec-builder \
-c chainspecs/staging/staging-raw.json \
convert-to-raw \
chainspecs/staging/staging-chainspec.json
# Verify the staging specs were created
echo "✅ Generated staging chain specifications:"
ls -la chainspecs/staging/
# Quick verification of content
echo "Verifying staging-chainspec.json content:"
jq '.name' chainspecs/staging/staging-chainspec.json || echo "Failed to parse JSON"
# Comprehensive verification
echo -e "\n📋 Verification of generated files:"
ls -l chainspecs/staging/staging-chainspec.json chainspecs/staging/staging-raw.json
echo -e "\n📄 Chain spec structure (first 5 lines):"
jq . chainspecs/staging/staging-chainspec.json 2>/dev/null | head -n 5 || true
echo -e "\n🔍 Checking file sizes:"
stat -c "staging-chainspec.json: %s bytes" chainspecs/staging/staging-chainspec.json
stat -c "staging-raw.json: %s bytes" chainspecs/staging/staging-raw.json
# Verify raw spec is SCALE-encoded (not JSON)
echo -e "\n🔬 Verifying raw spec format (first 200 bytes):"
head -c 200 chainspecs/staging/staging-raw.json | xxd | head -n 5 || echo "Could not read raw spec"
# Ensure files are not empty
if [ ! -s chainspecs/staging/staging-chainspec.json ]; then
echo "❌ Error: staging-chainspec.json is empty!"
exit 1
fi
if [ ! -s chainspecs/staging/staging-raw.json ]; then
echo "❌ Error: staging-raw.json is empty!"
exit 1
fi
echo "✅ All staging chain spec files are populated"
- name: Inject bootnodes into staging chain spec
run: |
set -euo pipefail
echo "🔗 Injecting bootnode peer IDs into staging chain spec..."
TARGET="staging"
SPEC="chainspecs/${TARGET}/staging-chainspec.json"
# Use external-only bootnodes (Parity's recommended approach)
# Both internal and external nodes use the same public endpoints
# Use bootnodes JSON directly (peer IDs are public and safe to log)
EXTERNAL_BOOTNODES="$EXTERNAL_BOOTNODES_JSON"
echo "📋 Using external-only bootnode architecture:"
# Only update if there are actual changes needed (idempotent)
CURRENT_BOOTNODES=$(jq -c '.bootNodes // []' "$SPEC")
CURRENT_PROTOCOL=$(jq -r '.protocolId // ""' "$SPEC")
CURRENT_SS58=$(jq -r '.properties.ss58Format // ""' "$SPEC")
CURRENT_DECIMALS=$(jq -r '.properties.tokenDecimals // ""' "$SPEC")
CURRENT_SYMBOL=$(jq -r '.properties.tokenSymbol // ""' "$SPEC")
if [ "$CURRENT_BOOTNODES" != "$EXTERNAL_BOOTNODES" ] || \
[ "$CURRENT_PROTOCOL" != "fenn" ] || \
[ "$CURRENT_SS58" != "42" ] || \
[ "$CURRENT_DECIMALS" != "12" ] || \
[ "$CURRENT_SYMBOL" != "FNL" ]; then
echo "📝 Updating bootNodes in ${TARGET} chain spec with peer IDs and chain metadata..."
jq --argjson arr "$EXTERNAL_BOOTNODES" \
--arg ss58 "42" \
'.bootNodes = $arr
| .protocolId = "fenn"
| .properties = {
"ss58Format": ($ss58|tonumber),
"tokenDecimals": 12,
"tokenSymbol": "FNL"
}' "$SPEC" > tmp.json && mv tmp.json "$SPEC"
# Regenerate raw spec with bootnodes included
echo "🔄 Regenerating raw ${TARGET} spec with bootnodes..."
chain-spec-builder \
-c "chainspecs/${TARGET}/staging-raw.json" \
convert-to-raw \
"chainspecs/${TARGET}/staging-chainspec.json"
echo "✅ Bootnodes updated successfully with peer IDs"
else
echo "✅ No changes needed - bootnodes already up to date"
fi
# Verify bootnodes configuration
echo "📊 Current bootNodes configuration:"
jq '.bootNodes' "$SPEC" || echo "No bootNodes found"
- name: Commit staging chainspecs to repository
run: |
# Configure git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Add the staging chainspecs
git add chainspecs/staging/staging-chainspec.json chainspecs/staging/staging-raw.json
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to staging chainspecs"
else
# Commit the changes with [ci skip] to prevent retriggering
git commit -m "Update staging chainspecs with bootnode peer IDs [ci skip]
- Peer IDs from GitHub secrets (BOOTNODE1_PEER_ID, BOOTNODE2_PEER_ID)
- Using external-only bootnode architecture (Parity best practice)
- Bootnode 1: $BOOTNODE1_PEER_ID
- Bootnode 2: $BOOTNODE2_PEER_ID"
# Fetch latest main and rebase our changes on top
git fetch origin main
git rebase origin/main
# Push the changes back to the repository (push current HEAD to main branch)
git push origin HEAD:main
echo "✅ Staging chainspecs committed and pushed to repository"
fi
# ------------------------------------------------------------
# PRODUCTION CHAINSPEC GENERATION
# Only generate production chainspecs for release tags
# ------------------------------------------------------------
- name: Create production chain specs
if: startsWith(github.ref, 'refs/tags/fennel-node-')
env:
PROD_SUDO_SS58: ${{ secrets.PROD_SUDO_SS58 }}
PROD_VAL1_AURA_PUB: ${{ secrets.PROD_VAL1_AURA_PUB }}
PROD_VAL1_GRANDPA_PUB: ${{ secrets.PROD_VAL1_GRANDPA_PUB }}
PROD_VAL1_STASH_SS58: ${{ secrets.PROD_VAL1_STASH_SS58 }}
PROD_VAL2_AURA_PUB: ${{ secrets.PROD_VAL2_AURA_PUB }}
PROD_VAL2_GRANDPA_PUB: ${{ secrets.PROD_VAL2_GRANDPA_PUB }}
PROD_VAL2_STASH_SS58: ${{ secrets.PROD_VAL2_STASH_SS58 }}
run: |
set -euo pipefail
echo "🏭 Generating production chainspecs for release tag..."
# Export environment variables for chain-spec-builder
export SUDO_SS58="${PROD_SUDO_SS58}"
export VAL1_AURA_PUB="${PROD_VAL1_AURA_PUB}"
export VAL1_GRANDPA_PUB="${PROD_VAL1_GRANDPA_PUB}"
export VAL1_STASH_SS58="${PROD_VAL1_STASH_SS58}"
export VAL2_AURA_PUB="${PROD_VAL2_AURA_PUB}"
export VAL2_GRANDPA_PUB="${PROD_VAL2_GRANDPA_PUB}"
export VAL2_STASH_SS58="${PROD_VAL2_STASH_SS58}"
# Verify environment variables are set
echo "🔍 Verifying production environment variables:"
echo "SUDO_SS58: ${SUDO_SS58}"
echo "VAL1_AURA_PUB: ${VAL1_AURA_PUB}"
echo "VAL1_GRANDPA_PUB: ${VAL1_GRANDPA_PUB}"
echo "VAL1_STASH_SS58: ${VAL1_STASH_SS58}"
echo "VAL2_AURA_PUB: ${VAL2_AURA_PUB}"
echo "VAL2_GRANDPA_PUB: ${VAL2_GRANDPA_PUB}"
echo "VAL2_STASH_SS58: ${VAL2_STASH_SS58}"
# Create production directory in chainspecs if it doesn't exist
mkdir -p chainspecs/production
# Debug: Check available presets in the runtime
echo "🔍 Checking available presets in production runtime..."
env SUDO_SS58="${SUDO_SS58}" \
VAL1_AURA_PUB="${VAL1_AURA_PUB}" \
VAL1_GRANDPA_PUB="${VAL1_GRANDPA_PUB}" \
VAL1_STASH_SS58="${VAL1_STASH_SS58}" \
VAL2_AURA_PUB="${VAL2_AURA_PUB}" \
VAL2_GRANDPA_PUB="${VAL2_GRANDPA_PUB}" \
VAL2_STASH_SS58="${VAL2_STASH_SS58}" \
chain-spec-builder list-presets \
--runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm || echo "Failed to list presets"
# Generate production chain spec
echo "Generating production chain spec..."
env SUDO_SS58="${SUDO_SS58}" \
VAL1_AURA_PUB="${VAL1_AURA_PUB}" \
VAL1_GRANDPA_PUB="${VAL1_GRANDPA_PUB}" \
VAL1_STASH_SS58="${VAL1_STASH_SS58}" \
VAL2_AURA_PUB="${VAL2_AURA_PUB}" \
VAL2_GRANDPA_PUB="${VAL2_GRANDPA_PUB}" \
VAL2_STASH_SS58="${VAL2_STASH_SS58}" \
chain-spec-builder \
-c chainspecs/production/production-chainspec.json \
create \
-r runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
named-preset production
# Generate raw production chain spec
echo "Generating raw production chain spec..."
chain-spec-builder \
-c chainspecs/production/production-raw.json \
convert-to-raw \
chainspecs/production/production-chainspec.json
# Verify the production specs were created
echo "✅ Generated production chain specifications:"
ls -la chainspecs/production/
# Quick verification of content
echo "Verifying production-chainspec.json content:"
jq '.name' chainspecs/production/production-chainspec.json || echo "Failed to parse JSON"
# Comprehensive verification
echo -e "\n📋 Verification of generated files:"
ls -l chainspecs/production/production-chainspec.json chainspecs/production/production-raw.json
echo -e "\n📄 Chain spec structure (first 5 lines):"
jq . chainspecs/production/production-chainspec.json 2>/dev/null | head -n 5 || true
echo -e "\n🔍 Checking file sizes:"
stat -c "production-chainspec.json: %s bytes" chainspecs/production/production-chainspec.json
stat -c "production-raw.json: %s bytes" chainspecs/production/production-raw.json
# Ensure files are not empty
if [ ! -s chainspecs/production/production-chainspec.json ]; then
echo "❌ Error: production-chainspec.json is empty!"
exit 1
fi
if [ ! -s chainspecs/production/production-raw.json ]; then
echo "❌ Error: production-raw.json is empty!"
exit 1
fi
echo "✅ All production chain spec files are populated"
- name: Inject bootnodes into production chain spec
if: startsWith(github.ref, 'refs/tags/fennel-node-')
run: |
set -euo pipefail
echo "🔗 Injecting bootnode peer IDs into production chain spec..."
TARGET="production"
SPEC="chainspecs/${TARGET}/production-chainspec.json"
# Use external-only bootnodes (Parity's recommended approach)
# Both internal and external nodes use the same public endpoints
# Use bootnodes JSON directly (peer IDs are public and safe to log)