Skip to content

Commit

Permalink
push attached files
Browse files Browse the repository at this point in the history
  • Loading branch information
cr7258 committed Jun 27, 2024
1 parent 159a652 commit bf5c250
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions .github/workflows/build-and-push-wasm-go-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,42 @@ jobs:
PLUGIN_DIRS=$(basename -a ./extensions/*)
fi
for plugin in ${PLUGIN_DIRS[@]}; do
echo "Build and push wasm go plugin: ${plugin}"
max_retries=3
retries=0
while [[ "${retries}" -lt "${max_retries}" ]]; do
IMAGE="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY }}/wasm-go-${plugin}:${PLUGIN_VERSION}"
PLUGIN_DIR="./extensions/${plugin}"
GOPROXY="https://proxy.golang.org,direct" PLUGIN_NAME="${plugin}" make build
for PLUGIN in ${PLUGIN_DIRS[@]}; do
echo "Build and push wasm go plugin: ${PLUGIN}"
MAX_RETRIES=3
RETRIES=0
while [[ "${RETRIES}" -lt "${MAX_RETRIES}" ]]; do
IMAGE="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY }}/wasm-go-${PLUGIN}:${PLUGIN_VERSION}"
PLUGIN_DIR="./extensions/${PLUGIN}"
GOPROXY="https://proxy.golang.org,direct" PLUGIN_NAME="${PLUGIN}" make build
if [[ $? -eq 0 ]]; then
tar czvf "${PLUGIN_DIR}/plugin.tar.gz" "${PLUGIN_DIR}/plugin.wasm"
oras push "$IMAGE" "${PLUGIN_DIR}/plugin.tar.gz:application/vnd.oci.image.layer.v1.tar+gzip"
PUSH_FILES="${PLUGIN_DIR}/plugin.tar.gz:application/vnd.oci.image.layer.v1.tar+gzip"
declare -A FILES=(
["spec.yaml"]="application/vnd.module.wasm.spec.v1+yaml"
["README.md"]="application/vnd.module.wasm.doc.v1+markdown"
["README_EN.md"]="application/vnd.module.wasm.doc.v1.en+markdown"
)
for FILE in "${!FILES[@]}"; do
FILE_PATH="${PLUGIN_DIR}/${FILE}"
if [[ -f "${FILE_PATH}" ]]; then
PUSH_FILES="${PUSH_FILES} ${FILE_PATH}:${FILES[$FILE]}"
fi
done
echo "${PUSH_FILES}"
echo "${FILES}"
oras push "${IMAGE}" "${PUSH_FILES}"
break
else
(( retries++ ))
echo "Build failed. Retrying ${retries}/${max_retries}..."
(( RETRIES++ ))
echo "Build failed. Retrying ${RETRIES}/${MAX_RETRIES}..."
fi
done
if [[ "${retries}" -eq "${max_retries}" ]]; then
echo "Build failed after ${max_retries} retries."
if [[ "${RETRIES}" -eq "${MAX_RETRIES}" ]]; then
echo "Build failed after ${MAX_RETRIES} retries."
exit 1
fi
done

0 comments on commit bf5c250

Please sign in to comment.