-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger ide.kaitai.io/devel rebuild after NPM publish (#1124)
* Trigger ide.kaitai.io/devel rebuild after NPM publish * updates from review * update workflow * cleanup * GH Actions: fix mismatched environment variable name * trigger-kaitai_struct_webide: also send KSC version Required by kaitai-io/kaitai_struct_webide@f968ac3 --------- Co-authored-by: Petr Pucil <[email protected]>
- Loading branch information
1 parent
8102887
commit 107fe14
Showing
2 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
#!/bin/sh -ef | ||
|
||
# https://travis-ci.com/kaitai-io/kaitai_struct_webide needs to be | ||
# rebuilt after we publish newest JS build of ksc to npm. | ||
# ide.kaitai.io/devel needs to be rebuilt after we publish the latest JS build of KSC to npm. | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <ksc_version>" | ||
exit 1 | ||
fi | ||
|
||
ksc_version=$1 | ||
|
||
PROJECT='kaitai-io/kaitai_struct_webide' | ||
SLUG=$(echo "$PROJECT" | sed 's,/,%2F,g') | ||
|
||
echo "Triggering build for $PROJECT project..." | ||
if [ -n "$KAITAI_STRUCT_WEBIDE_TOKEN" ]; then | ||
body=' | ||
{ | ||
"request": { | ||
"message": "Build with kaitai-struct-compiler v'"$KAITAI_STRUCT_VERSION"'", | ||
"branch": "master" | ||
} | ||
} | ||
' | ||
if [ -n "$KAITAI_STRUCT_WEBIDE_GITHUB_TOKEN" ]; then | ||
# `event_type` must match the name whitelisted in the CI workflow config in | ||
# https://github.com/kaitai-io/kaitai_struct_webide | ||
body=$(jq -n -c --arg ksc_version "$ksc_version" '{event_type: "rebuild", client_payload: {ksc_version: $ksc_version}}') | ||
|
||
echo "$body" | ||
printf '%s\n' "$body" | ||
|
||
curl -v -fsSL \ | ||
-H "Content-Type: application/json" \ | ||
-H "Accept: application/json" \ | ||
-H "Travis-API-Version: 3" \ | ||
-H "Authorization: token $KAITAI_STRUCT_WEBIDE_TOKEN" \ | ||
curl -fsSL \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $KAITAI_STRUCT_WEBIDE_GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-d "$body" \ | ||
"https://api.travis-ci.com/repo/$SLUG/requests" | ||
"https://api.github.com/repos/$PROJECT/dispatches" | ||
else | ||
echo "No KAITAI_STRUCT_WEBIDE_TOKEN found!" | ||
echo "No KAITAI_STRUCT_WEBIDE_GITHUB_TOKEN found!" | ||
exit 1 | ||
fi |