feat: improve substream release script
Improvements include: - exit the script if any non-recoverable step fails - fix bug where cargo version was hardcoded to be detected in balancer package - allow optional input of substream config file. This is necessary for protocols with forks as they will have multiple configs in one directory
This commit is contained in:
6
.github/workflows/substream.cd.yaml
vendored
6
.github/workflows/substream.cd.yaml
vendored
@@ -9,6 +9,10 @@ on:
|
|||||||
package:
|
package:
|
||||||
required: true
|
required: true
|
||||||
description: "Package to build"
|
description: "Package to build"
|
||||||
|
config_file:
|
||||||
|
required: false
|
||||||
|
description: "Path to the substreams configuration file"
|
||||||
|
default: "substreams.yaml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Release:
|
Release:
|
||||||
@@ -42,4 +46,4 @@ jobs:
|
|||||||
- name: Run checks
|
- name: Run checks
|
||||||
run: |
|
run: |
|
||||||
cd substreams
|
cd substreams
|
||||||
./release.sh ${{ inputs.package }}
|
./release.sh ${{ inputs.package }} ${{ inputs.config_file }}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ if [ -n "$current_tag" ]; then
|
|||||||
# Semantic version
|
# Semantic version
|
||||||
version="${BASH_REMATCH[2]}"
|
version="${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
cargo_version=$(cargo pkgid -p ethereum-balancer | cut -d# -f2 | cut -d: -f2)
|
cargo_version=$(cargo pkgid -p "$package" | cut -d# -f2 | cut -d: -f2)
|
||||||
if [[ "$cargo_version" != "$version" ]]; then
|
if [[ "$cargo_version" != "$version" ]]; then
|
||||||
echo "Error: Cargo version: ${cargo_version} does not match tag version: ${version}!"
|
echo "Error: Cargo version: ${cargo_version} does not match tag version: ${version}!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -52,9 +52,18 @@ fi
|
|||||||
REPOSITORY=${REPOSITORY:-"s3://repo.propellerheads/substreams"}
|
REPOSITORY=${REPOSITORY:-"s3://repo.propellerheads/substreams"}
|
||||||
repository_path="$REPOSITORY/$package/$package-$version.spkg"
|
repository_path="$REPOSITORY/$package/$package-$version.spkg"
|
||||||
|
|
||||||
|
# Optional input for yaml file; defaults to substreams.yaml if not provided
|
||||||
|
yaml_file=${2:-"substreams.yaml"}
|
||||||
|
|
||||||
|
if [[ ! -f "$package/$yaml_file" ]]; then
|
||||||
|
echo "Error: manifest reader: unable to stat input file $yaml_file: file does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e # Exit the script if any command fails
|
||||||
cargo build --target wasm32-unknown-unknown --release -p "$package"
|
cargo build --target wasm32-unknown-unknown --release -p "$package"
|
||||||
mkdir -p ./target/spkg/
|
mkdir -p ./target/spkg/
|
||||||
substreams pack $package/substreams.yaml -o ./target/spkg/$package-$version.spkg
|
substreams pack "$package/$yaml_file" -o ./target/spkg/$package-$version.spkg
|
||||||
aws s3 cp ./target/spkg/$package-$version.spkg $repository_path
|
aws s3 cp ./target/spkg/$package-$version.spkg $repository_path
|
||||||
|
|
||||||
echo "Released substreams package: '$repository_path'"
|
echo "Released substreams package: '$repository_path'"
|
||||||
|
|||||||
Reference in New Issue
Block a user