New pipeline type for Obsidian plugins: builds with esbuild, runs quality gates, and publishes main.js/manifest.json/styles.css to GitHub Releases. Extends github_release job with release_artifacts parameter for artifact uploads. 616 tests passing.
72 lines
2.4 KiB
Bash
Executable File
72 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Build a self-contained generate_config.sh that embeds all helpers
|
|
# and templates. The orb includes this packed version via << include() >>.
|
|
#
|
|
# Source files remain separate in src/scripts/ for development and testing.
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
SRC="${PROJECT_DIR}/src/scripts"
|
|
OUT="${SRC}/packed_generate_config.sh"
|
|
|
|
echo "Packing generate_config.sh..."
|
|
|
|
{
|
|
echo '#!/usr/bin/env bash'
|
|
echo 'set -euo pipefail'
|
|
echo ''
|
|
echo '# ======================================================================'
|
|
echo '# AUTO-GENERATED by scripts/pack_generate_config.sh'
|
|
echo '# Do not edit directly. Edit src/scripts/*.sh and re-pack.'
|
|
echo '# ======================================================================'
|
|
echo ''
|
|
echo '# Stage helper files to /tmp/munitor/ so generate_config.sh can find them'
|
|
echo 'mkdir -p /tmp/munitor/templates/partials'
|
|
echo ''
|
|
|
|
# Embed munitor_helpers.sh
|
|
echo 'cat > /tmp/munitor/munitor_helpers.sh << '"'"'MUNITOR_HELPERS_EOF'"'"
|
|
cat "${SRC}/munitor_helpers.sh"
|
|
echo 'MUNITOR_HELPERS_EOF'
|
|
echo ''
|
|
|
|
# Embed extract_munitor_vars.sh
|
|
echo 'cat > /tmp/munitor/extract_munitor_vars.sh << '"'"'MUNITOR_EXTRACT_EOF'"'"
|
|
cat "${SRC}/extract_munitor_vars.sh"
|
|
echo 'MUNITOR_EXTRACT_EOF'
|
|
echo ''
|
|
|
|
# Embed each template
|
|
for tpl in java-webapp gradle-webapp node-api node-webapp terraform sdk-distribution validate-cd-repo argocd-apps obsidian-plugin; do
|
|
echo "cat > /tmp/munitor/templates/${tpl}.yml.tpl << 'MUNITOR_TPL_EOF'"
|
|
cat "${SRC}/templates/${tpl}.yml.tpl"
|
|
echo 'MUNITOR_TPL_EOF'
|
|
echo ''
|
|
done
|
|
|
|
# Embed partials
|
|
for partial in java-webapp-deploy gradle-webapp-deploy node-api-deploy node-webapp-deploy; do
|
|
echo "cat > /tmp/munitor/templates/partials/${partial}.yml.tpl << 'MUNITOR_PARTIAL_EOF'"
|
|
cat "${SRC}/templates/partials/${partial}.yml.tpl"
|
|
echo 'MUNITOR_PARTIAL_EOF'
|
|
echo ''
|
|
done
|
|
|
|
echo 'echo "Munitor helpers staged to /tmp/munitor/"'
|
|
echo ''
|
|
echo '# ======================================================================'
|
|
echo '# Main generate_config.sh logic'
|
|
echo '# ======================================================================'
|
|
echo ''
|
|
|
|
# Append the main script, skipping the shebang
|
|
tail -n +2 "${SRC}/generate_config.sh"
|
|
|
|
} > "${OUT}"
|
|
|
|
chmod +x "${OUT}"
|
|
echo "Packed to: ${OUT}"
|
|
echo "Lines: $(wc -l < "${OUT}")"
|