-
Notifications
You must be signed in to change notification settings - Fork 10
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 (#146)
- Loading branch information
1 parent
279f807
commit 53f5008
Showing
9 changed files
with
74 additions
and
24 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
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,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-$GITHUB_ACTION_REPOSITORY} | ||
|
||
if [ -z "$GITHUB_REPOSITORY" ]; then | ||
echo "Error: GITHUB_REPOSITORY or GITHUB_ACTION_REPOSITORY is not set." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$GITHUB_TOKEN" ]; then | ||
echo "Error: GITHUB_TOKEN is not set." | ||
exit 1 | ||
fi | ||
|
||
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_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_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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
jest.config.js | ||
tsconfig.build.json | ||
tsconfig.json | ||
.eslintrc.json | ||
|
||
# Source and test files | ||
src | ||
|
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
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