-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b9a03e
commit cde1d54
Showing
1 changed file
with
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: CD | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
notify-pkg: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Refresh Go Modules | ||
env: | ||
BASE_URL: "https://pkg.go.dev/fetch" | ||
REPO_URL: "github.com/${{ github.repository }}" | ||
RELEASE_TAG: "${{ github.event.release.tag_name }}" | ||
run: | | ||
# If the tag contains '/', replace the last '/' with '@' | ||
if [[ "$RELEASE_TAG" == *"/"* ]]; then | ||
FORMATTED_TAG="/${RELEASE_TAG%/*}@${RELEASE_TAG##*/}" | ||
else | ||
FORMATTED_TAG="@${RELEASE_TAG}" | ||
fi | ||
FULL_URL="${BASE_URL}/${REPO_URL}${FORMATTED_TAG}" | ||
echo "Sending POST request to $FULL_URL" | ||
# Send the POST request | ||
curl -X POST "$FULL_URL" \ | ||
-H "Content-Type: application/json" \ | ||
--fail \ | ||
|| echo "Failed to notify pkg.go.dev" |