Skip to content

Commit 523bfe6

Browse files
committed
fix: write sparkle appcasts to staged output path
1 parent 0774853 commit 523bfe6

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

scripts/generate-sparkle-appcast.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ cmd=(
7070
--download-url-prefix "${RELEASE_BASE_URL%/}/"
7171
--maximum-deltas 0
7272
--maximum-versions "${MAX_VERSIONS}"
73-
-o "${APPCAST_NAME}"
73+
-o "${STAGE_DIR}/${APPCAST_NAME}"
7474
)
7575

7676
if [[ -n "${FULL_RELEASE_NOTES_URL}" ]]; then
@@ -85,5 +85,10 @@ cmd+=("${STAGE_DIR}")
8585

8686
printf '%s' "${PRIVATE_ED_KEY}" | "${cmd[@]}"
8787

88+
if [[ ! -f "${STAGE_DIR}/${APPCAST_NAME}" ]]; then
89+
echo "generate_appcast did not produce ${STAGE_DIR}/${APPCAST_NAME}" >&2
90+
exit 1
91+
fi
92+
8893
cp "${STAGE_DIR}/${APPCAST_NAME}" "${OUTPUT_DIR}/${APPCAST_NAME}"
8994
echo "Generated Sparkle appcast at ${OUTPUT_DIR}/${APPCAST_NAME}"

scripts/generate-sparkle-appcast.test.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,22 @@ test('generate-sparkle-appcast stages dmg assets and preserves appcast output on
3030
'set -euo pipefail',
3131
`printf '%s\\n' "$@" > "${argsLog}"`,
3232
`cat > "${stdinLog}"`,
33+
'output_path=""',
34+
'for ((i=1; i<=$#; i++)); do',
35+
' if [[ "${!i}" == "-o" ]]; then',
36+
' j=$((i + 1))',
37+
' output_path="${!j}"',
38+
' break',
39+
' fi',
40+
'done',
41+
'test -n "${output_path}"',
3342
'archive_dir="${!#}"',
3443
'test -f "${archive_dir}/GetTokens_macOS_AppleSilicon.dmg"',
3544
'test -f "${archive_dir}/GetTokens_macOS_Intel.dmg"',
3645
'test ! -f "${archive_dir}/GetTokens_macOS_AppleSilicon.tar.gz"',
3746
'test -f "${archive_dir}/appcast.xml"',
38-
'printf \'<rss>new</rss>\' > "${archive_dir}/appcast.xml"',
47+
'mkdir -p "$(dirname "${output_path}")"',
48+
'printf \'<rss>new</rss>\' > "${output_path}"',
3949
'',
4050
].join('\n'),
4151
{ mode: 0o755 },
@@ -60,5 +70,6 @@ test('generate-sparkle-appcast stages dmg assets and preserves appcast output on
6070
assert.match(args, /--download-url-prefix\nhttps:\/\/example.com\/releases\/download\/v0.1.7\//);
6171
assert.match(args, /--full-release-notes-url\nhttps:\/\/example.com\/releases\/tag\/v0.1.7/);
6272
assert.match(args, /--link\nhttps:\/\/example.com\/GetTokens/);
73+
assert.match(args, /-o\n.+appcast\.xml/);
6374
assert.equal(fs.readFileSync(stdinLog, 'utf8'), 'test-private-key');
6475
});

0 commit comments

Comments
 (0)