|
| 1 | +set shell := ["zsh", "-cu"] |
| 2 | + |
| 3 | +plugin_label := "stockingLocationsPlugin" |
| 4 | +package_zip := "dist/stockingLocationsPlugin.zip" |
| 5 | +descriptor_file := "plugin_descriptor.json" |
| 6 | +secure_dir := env_var_or_default("HOME", "") + "/.secure" |
| 7 | + |
| 8 | +default: |
| 9 | + just --list |
| 10 | + |
| 11 | +build: |
| 12 | + npm run build |
| 13 | + |
| 14 | +package: build |
| 15 | + mkdir -p dist |
| 16 | + rm -f {{package_zip}} |
| 17 | + stage_dir=$(mktemp -d /tmp/history-search-package.XXXXXX); \ |
| 18 | + trap 'rm -rf "$stage_dir"' EXIT; \ |
| 19 | + jq -r '.src_files[]' {{descriptor_file}} | while read -r file; do \ |
| 20 | + if [ "$file" = "{{descriptor_file}}" ]; then \ |
| 21 | + source_path="$file"; \ |
| 22 | + else \ |
| 23 | + source_path="web/$file"; \ |
| 24 | + fi; \ |
| 25 | + target_path="$stage_dir/$file"; \ |
| 26 | + mkdir -p "$(dirname "$target_path")"; \ |
| 27 | + cp "$source_path" "$target_path"; \ |
| 28 | + done; \ |
| 29 | + cd "$stage_dir" && zip -rq "$OLDPWD/{{package_zip}}" . |
| 30 | + |
| 31 | +upload env: package |
| 32 | + plugin_mgr_credentials="{{secure_dir}}/{{env}}-plugin_mgr.secret"; \ |
| 33 | + default_credentials="{{secure_dir}}/{{env}}.secret"; \ |
| 34 | + if [ -f "$plugin_mgr_credentials" ]; then \ |
| 35 | + credentials="$plugin_mgr_credentials"; \ |
| 36 | + elif [ -f "$default_credentials" ]; then \ |
| 37 | + credentials="$default_credentials"; \ |
| 38 | + else \ |
| 39 | + echo "No credentials file found for '{{env}}'. Tried:" >&2; \ |
| 40 | + echo " $plugin_mgr_credentials" >&2; \ |
| 41 | + echo " $default_credentials" >&2; \ |
| 42 | + exit 1; \ |
| 43 | + fi; \ |
| 44 | + npx pluginmgr upload {{plugin_label}} --credentials "$credentials" --filename {{package_zip}} --descriptorFile {{descriptor_file}} |
| 45 | + |
| 46 | +upload-sunrise: |
| 47 | + just upload sunrise0511 |
0 commit comments