-
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.
Refactor publish pipeline around Git tags (GEA-12976) (#217)
- Loading branch information
Showing
7 changed files
with
94 additions
and
23 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 |
---|---|---|
|
@@ -11,3 +11,7 @@ indent_style = tab | |
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.sh] | ||
indent_size = 4 | ||
indent_style = space |
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 |
---|---|---|
|
@@ -6,6 +6,24 @@ Future support is incoming. | |
To install our linters, simply run `./dev/setup_repo.sh` | ||
These linters will run on every `git commit` operation. | ||
|
||
## Publishing | ||
|
||
Publishing pangea-sdk to pkg.go.dev is handled via a private GitLab CI pipeline. | ||
This pipeline is triggered when a Git tag is pushed to the repository. Git tags | ||
should be formatted as `pangea-sdk/vX.Y.Z`, where `vX.Y.Z` is the version number | ||
to publish. | ||
|
||
1. Update the `version` constant in `pangea-sdk/v3/pangea/pangea.go`. | ||
2. Update the release notes in `CHANGELOG.md`. | ||
3. Author a commit with these changes and land it on `main`. | ||
4. `git tag -m pangea-sdk/vX.Y.Z pangea-sdk/vX.Y.Z 0000000`. Replace `vX.Y.Z` | ||
with the new version number and `0000000` with the commit SHA from the | ||
previous step. | ||
5. `git push --tags origin main`. | ||
|
||
From here the GitLab CI pipeline will pick up the pushed Git tag and publish | ||
the package to pkg.go.dev. | ||
|
||
## Contributors | ||
|
||
- Andrés Tournour ([email protected]). Code. | ||
|
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,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ $# -lt 1 ]; then | ||
echo "usage: validate_tag.sh <git_tag>" | ||
exit 1 | ||
fi | ||
|
||
GIT_TAG=$1 | ||
|
||
if [[ ! $GIT_TAG == "pangea-sdk/v"* ]]; then | ||
echo "Git tag must begin with a 'pangea-sdk/v'." | ||
exit 1 | ||
fi | ||
|
||
PACKAGE_NAME=$(echo "$GIT_TAG" | cut -d "/" -f 1) | ||
VERSION=$(echo "$GIT_TAG" | cut -d "/" -f 2) | ||
|
||
if [[ ! "$VERSION" == *"v"* ]]; then | ||
echo "Git tag must contain a version number that's prefixed with 'v'." | ||
exit 1 | ||
fi | ||
|
||
# Trim the 'v'. | ||
VERSION="${VERSION:1}" | ||
|
||
# Move to repo root. | ||
PARENT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P) | ||
pushd "$PARENT_PATH/.." | ||
|
||
GO_CONST_VERSION=$(grep -Eo "version.+=.+" pangea-sdk/v3/pangea/pangea.go | head -1) | ||
|
||
if [[ ! "$GO_CONST_VERSION" == *"$VERSION"* ]]; then | ||
echo "Git tag version '$VERSION' does not match Go constant version '$GO_CONST_VERSION'." | ||
exit 1 | ||
fi | ||
|
||
popd |
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