Skip to content

Commit 66b4f8c

Browse files
Merge pull request #26 from CorruptedAesthetic/staging-preset-implementation
fix: update chainspec paths to use Chainspecs/Development and Chainsp…
2 parents 85e05b5 + 3abc9a7 commit 66b4f8c

1 file changed

Lines changed: 44 additions & 22 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,63 +108,87 @@ jobs:
108108
109109
- name: Create development chain spec
110110
run: |
111-
# Create chainspecs directory if it doesn't exist
112-
mkdir -p chainspecs
111+
# Create Development directory in Chainspecs if it doesn't exist
112+
mkdir -p Chainspecs/Development
113113
114114
# Check if the runtime has a development preset
115115
echo "Checking available presets..."
116116
chain-spec-builder list-presets \
117117
--runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm || true
118118
119+
# Check if runtime exists
120+
echo "Checking if runtime WASM exists..."
121+
ls -la runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm || echo "Runtime WASM not found!"
122+
119123
# Use the development preset from the runtime
120124
echo "Creating development chain spec using 'development' preset..."
121-
chain-spec-builder create \
125+
if ! chain-spec-builder create \
122126
--runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
123127
named-preset development \
124-
> chainspecs/development.json
128+
> Chainspecs/Development/development.json 2>&1; then
129+
echo "Error creating development chain spec. Output:"
130+
cat Chainspecs/Development/development.json
131+
exit 1
132+
fi
133+
134+
# Check if file has content
135+
if [ ! -s Chainspecs/Development/development.json ]; then
136+
echo "Error: development.json is empty!"
137+
exit 1
138+
fi
125139
126140
# Convert to raw format
127141
echo "Converting to raw format..."
128-
chain-spec-builder convert-to-raw chainspecs/development.json > chainspecs/development-raw.json
142+
chain-spec-builder convert-to-raw Chainspecs/Development/development.json > Chainspecs/Development/development-raw.json
129143
130144
# Verify the specs were created
131145
echo "✅ Generated chain specifications:"
132-
ls -l chainspecs/
146+
ls -l Chainspecs/Development/
133147
134148
# Output the final chain spec structure
135149
echo "Final chain spec structure:"
136-
jq -r '.genesis.runtime | keys[]' chainspecs/development.json || true
150+
jq -r '.genesis.runtime | keys[]' Chainspecs/Development/development.json || true
137151
138152
- name: Create staging chain specs with bootnodes
139153
run: |
140-
# Create Staging directory for staging chainspecs
141-
mkdir -p Staging
154+
# Create Staging directory in Chainspecs if it doesn't exist
155+
mkdir -p Chainspecs/Staging
142156
143157
# Generate staging chain spec (plain) with bootnodes
144158
echo "Generating staging chain spec with bootnodes..."
145-
chain-spec-builder create \
159+
if ! chain-spec-builder create \
146160
--runtime runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm \
147161
named-preset staging \
148-
> Staging/staging-chainspec.json
162+
> Chainspecs/Staging/staging-chainspec.json 2>&1; then
163+
echo "Error creating staging chain spec. Output:"
164+
cat Chainspecs/Staging/staging-chainspec.json
165+
exit 1
166+
fi
167+
168+
# Check if file has content
169+
if [ ! -s Chainspecs/Staging/staging-chainspec.json ]; then
170+
echo "Error: staging-chainspec.json is empty!"
171+
exit 1
172+
fi
149173
150174
# Add bootnodes to the staging chain spec
151175
echo "Adding bootnodes to staging chain spec..."
152176
jq '.bootNodes = [
153177
"/dns/fennel-bootnode-1.fennel-staging.svc.cluster.local/tcp/30333/p2p/12D3KooWDCZGrnJhsgWJtDcs6eZc1hUBrVj5QqkEWggAkNVowRAi",
154178
"/dns/fennel-bootnode-2.fennel-staging.svc.cluster.local/tcp/30333/p2p/12D3KooWDbfFv6oepAXmQaiwFaVjD9g7AxowQ8LQdWTcVYpKhnAx"
155-
]' Staging/staging-chainspec.json > Staging/staging-chainspec-temp.json && mv Staging/staging-chainspec-temp.json Staging/staging-chainspec.json
179+
]' Chainspecs/Staging/staging-chainspec.json > Chainspecs/Staging/staging-chainspec-temp.json && mv Chainspecs/Staging/staging-chainspec-temp.json Chainspecs/Staging/staging-chainspec.json
156180
157181
# Generate staging chain spec (raw) with bootnodes
158182
echo "Generating raw staging chain spec..."
159-
chain-spec-builder convert-to-raw Staging/staging-chainspec.json > Staging/staging-raw.json
183+
chain-spec-builder convert-to-raw Chainspecs/Staging/staging-chainspec.json > Chainspecs/Staging/staging-raw.json
160184
161185
# Verify the staging specs were created
162186
echo "✅ Generated staging chain specifications:"
163-
ls -la Staging/
187+
ls -la Chainspecs/Staging/
164188
165189
# Show bootnode configuration in the generated specs
166190
echo "Bootnode configuration in staging spec:"
167-
jq -r '.bootNodes[]' Staging/staging-chainspec.json
191+
jq -r '.bootNodes[]' Chainspecs/Staging/staging-chainspec.json
168192
169193
- name: Commit staging chainspecs to repository
170194
run: |
@@ -173,7 +197,7 @@ jobs:
173197
git config --local user.name "GitHub Action"
174198
175199
# Add the staging chainspecs
176-
git add Staging/staging-chainspec.json Staging/staging-raw.json
200+
git add Chainspecs/Staging/staging-chainspec.json Chainspecs/Staging/staging-raw.json
177201
178202
# Check if there are changes to commit
179203
if git diff --staged --quiet; then
@@ -193,12 +217,10 @@ jobs:
193217
with:
194218
name: fennel-chainspecs
195219
path: |
196-
chainspecs/default-genesis.json
197-
chainspecs/development-patch.json
198-
chainspecs/development.json
199-
chainspecs/development-raw.json
200-
Staging/staging-chainspec.json
201-
Staging/staging-raw.json
220+
Chainspecs/Development/development.json
221+
Chainspecs/Development/development-raw.json
222+
Chainspecs/Staging/staging-chainspec.json
223+
Chainspecs/Staging/staging-raw.json
202224
203225
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
204226
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.

0 commit comments

Comments
 (0)