-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ts): does not mark ts release as latest in github
- Loading branch information
1 parent
9452e22
commit b3e5145
Showing
3 changed files
with
44 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
.PHONY: release-ts | ||
release-ts: $(AKASH_TS_NODE_MODULES) $(AKASH_TS_ROOT)/dist | ||
if [ -z "$$CI" ]; then \ | ||
cd $(AKASH_TS_ROOT) && npx semantic-release --no-ci; \ | ||
else \ | ||
cd $(AKASH_TS_ROOT) && npx semantic-release; \ | ||
fi | ||
script/release-ts.sh | ||
|
||
$(AKASH_TS_ROOT)/dist: $(shell find $(AKASH_TS_ROOT)/src -type f) | ||
cd $(AKASH_TS_ROOT) && npm run build |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
API_URL="https://api.github.com" | ||
|
||
log() { | ||
echo "$(date +"[%I:%M:%S %p]") [ts-release] $1" | ||
} | ||
|
||
log "Fetching the current latest release information..." | ||
current_latest=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" \ | ||
"$API_URL/repos/$GITHUB_ACTION_REPOSITORY/releases/latest") | ||
current_latest_id=$(echo "$current_latest" | jq -r '.id') | ||
|
||
if [ "$current_latest_id" == "null" ]; then | ||
log "No current latest release found." | ||
exit 1 | ||
else | ||
log "Current latest release ID: $current_latest_id" | ||
fi | ||
|
||
log "Running semantic-release..." | ||
if [ -z "$CI" ]; then | ||
log "Running in non-CI mode..." | ||
cd "$AKASH_TS_ROOT" && npx semantic-release --no-ci | ||
else | ||
log "Running in CI mode..." | ||
cd "$AKASH_TS_ROOT" && npx semantic-release | ||
fi | ||
|
||
log "Attempting to mark the release (ID: $current_latest_id) as the latest again..." | ||
update_response=$(curl -s -X PATCH -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3+json" \ | ||
-d "{\"make_latest\": \"true\"}" \ | ||
"$API_URL/repos/$GITHUB_ACTION_REPOSITORY/releases/$current_latest_id") | ||
|
||
log "Update response:" | ||
echo "$update_response" | jq | ||
|
||
if echo "$update_response" | jq -e '.id'; then | ||
log "The release was successfully marked as the latest." | ||
else | ||
log "Failed to update the release. Check the response above for errors." | ||
fi |
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