-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from TomVasile/zh-sre-556
CI: Add wasm tar.gz on release
- Loading branch information
Showing
5 changed files
with
113 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: publish-cep-78-contracts | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
publish-contract-tarball: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2 | ||
- uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c #v1.4.0 | ||
|
||
- name: Install dependencies | ||
run: sudo apt update && sudo apt install -y build-essential wabt | ||
|
||
- name: Setup | ||
run: make prepare | ||
|
||
- name: Build wasm contracts | ||
run: make build-contract | ||
|
||
- name: Create tarball | ||
run: ./ci/package_wasm.sh | ||
|
||
- name: Upload tarball to release | ||
uses: svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575 #v2.3.0 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: /tmp/ci_package_wasm_${{ github.ref_name }}/cep-78-wasm.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
BUILD_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd)" | ||
IGNORE='minting_contract' | ||
WASM_FILE_PATH_ARRAY=($(cat "$BUILD_ROOT_DIR/Makefile" | grep 'wasm-strip' | awk -F' ' '{print $2}')) | ||
TAG=${GITHUB_REF_NAME:-local} | ||
TEMP_DIR="/tmp/ci_package_wasm_$TAG" | ||
TARBALL="cep-78-wasm.tar.gz" | ||
|
||
# Hygiene for local debugging. Won't apply to CI. | ||
if [ -d "$TEMP_DIR" ]; then | ||
rm -rf "$TEMP_DIR" | ||
fi | ||
|
||
# Create temporary directory for staging tarball | ||
mkdir -p "$TEMP_DIR" | ||
|
||
if [ -d "$TEMP_DIR" ]; then | ||
# Loop over the contracts | ||
for wasm_path in "${WASM_FILE_PATH_ARRAY[@]}"; do | ||
# Ignore minting_contract, used only in testing | ||
if [[ "$wasm_path" != *"$IGNORE"* ]]; then | ||
# Copy the other wasm files if they exist | ||
if [ -f "$wasm_path" ]; then | ||
echo "copying $wasm_path to $TEMP_DIR" | ||
cp "$wasm_path" "$TEMP_DIR/" | ||
fi | ||
fi | ||
done | ||
|
||
# Move to the staging directory | ||
pushd "$TEMP_DIR" > /dev/null | ||
echo "" | ||
echo "creating $TEMP_DIR/$TARBALL" | ||
echo "" | ||
# create the tarball | ||
tar -czf "$TARBALL" *.wasm --remove-files | ||
# Move back | ||
popd > /dev/null | ||
fi | ||
|
||
echo "success!" |