-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move
latest
tag upon releasing new versions (#24)
* chore: move "latest" tag upon releasing new versions * format * comment * simplify git delete tag operation
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
move_tag() { | ||
local package="$1" | ||
local commit_sha="$2" | ||
local tag="$package@latest" | ||
|
||
git push -d origin "$tag" | ||
git tag "$tag" "$commit_sha" | ||
git push origin "$tag" | ||
} | ||
|
||
get_package_names() { | ||
jq -r '.[].name' "$1" | ||
} | ||
|
||
main() { | ||
local published_packages="$1" | ||
local commit_sha="$2" | ||
|
||
while IFS= read -r package; do | ||
move_tag "$package" "$commit_sha" | ||
done < <(get_package_names "$published_packages") | ||
} | ||
|
||
main "$@" |