|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +if [ $# -ne 2 ]; then |
| 4 | + echo 1>&2 "Usage: $0 VERSION_STRING CHECKSUM_FILE" |
| 5 | + exit 3 |
| 6 | +fi |
| 7 | + |
| 8 | +[ ! -f "$2" ] && echo -e "The second argument has to be the checksum file\n\n"Usage: $0 VERSION_STRING CHECKSUM_FILE"" && exit 3 |
| 9 | + |
| 10 | +# The first argument is if the version (either the tag or canary) |
| 11 | +# The second argument is the checksum file |
| 12 | +SPIN_COMPAT_STRING=$(cat manifest/plugin-spin-compat.txt ) |
| 13 | +VERSION=$1 |
| 14 | +PLUGIN_BINARY_VERSION_STRING=$1 |
| 15 | + |
| 16 | + |
| 17 | +# If canary release tag with epoch at the end as it is monotonic |
| 18 | +if [[ $VERSION == "canary" ]]; then |
| 19 | + PLUGIN_VERSION=$(cat ./crates/spin-python-engine/Cargo.toml | grep version | head -n 1 | awk '{print $3}') |
| 20 | + VERSION="${PLUGIN_VERSION//\"}post.$(date +%s)" |
| 21 | + PLUGIN_BINARY_VERSION_STRING="canary" |
| 22 | +fi |
| 23 | + |
| 24 | +# Gather the checksums |
| 25 | + |
| 26 | +LINUX_ARM=$(cat $2 | grep "linux-aarch64" | awk '{print $1}') |
| 27 | +LINUX_AMD=$(cat $2 | grep "linux-amd64" | awk '{print $1}') |
| 28 | +MAC_ARM=$(cat $2 | grep "macos-aarch64" | awk '{print $1}') |
| 29 | +MAC_AMD=$(cat $2 | grep "macos-amd64" | awk '{print $1}') |
| 30 | +WINDOWS_AMD=$(cat $2 | grep "windows-amd64" | awk '{print $1}') |
| 31 | + |
| 32 | +# Dump out the json manifest |
| 33 | +cat <<EOF |
| 34 | +{ |
| 35 | + "name": "py2wasm", |
| 36 | + "description": "A plugin to convert Python applications to Spin compatible modules", |
| 37 | + "homepage": "https://github.com/fermyon/spin-python-sdk", |
| 38 | + "version": "${VERSION//v}", |
| 39 | + "spinCompatibility": "${SPIN_COMPAT_STRING}", |
| 40 | + "license": "Apache-2.0", |
| 41 | + "packages": [ |
| 42 | + { |
| 43 | + "os": "linux", |
| 44 | + "arch": "amd64", |
| 45 | + "url": "https://github.com/fermyon/spin-python-sdk/releases/download/${PLUGIN_BINARY_VERSION_STRING}/py2wasm-${PLUGIN_BINARY_VERSION_STRING}-linux-amd64.tar.gz", |
| 46 | + "sha256": "${LINUX_AMD}" |
| 47 | + }, |
| 48 | + { |
| 49 | + "os": "linux", |
| 50 | + "arch": "aarch64", |
| 51 | + "url": "https://github.com/fermyon/spin-python-sdk/releases/download/${PLUGIN_BINARY_VERSION_STRING}/py2wasm-${PLUGIN_BINARY_VERSION_STRING}-linux-aarch64.tar.gz", |
| 52 | + "sha256": "${LINUX_ARM}" |
| 53 | + }, |
| 54 | + { |
| 55 | + "os": "macos", |
| 56 | + "arch": "aarch64", |
| 57 | + "url": "https://github.com/fermyon/spin-python-sdk/releases/download/${PLUGIN_BINARY_VERSION_STRING}/py2wasm-${PLUGIN_BINARY_VERSION_STRING}-macos-aarch64.tar.gz", |
| 58 | + "sha256": "${MAC_ARM}" |
| 59 | + }, |
| 60 | + { |
| 61 | + "os": "macos", |
| 62 | + "arch": "amd64", |
| 63 | + "url": "https://github.com/fermyon/spin-python-sdk/releases/download/${PLUGIN_BINARY_VERSION_STRING}/py2wasm-${PLUGIN_BINARY_VERSION_STRING}-macos-amd64.tar.gz", |
| 64 | + "sha256": "${MAC_AMD}" |
| 65 | + }, |
| 66 | + { |
| 67 | + "os": "windows", |
| 68 | + "arch": "amd64", |
| 69 | + "url": "https://github.com/fermyon/spin-python-sdk/releases/download/${PLUGIN_BINARY_VERSION_STRING}/py2wasm-${PLUGIN_BINARY_VERSION_STRING}-windows-amd64.tar.gz", |
| 70 | + "sha256": "${WINDOWS_AMD}" |
| 71 | + } |
| 72 | + ] |
| 73 | +} |
| 74 | +EOF |
0 commit comments