-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove release on test PyPI, OIDC auth, fix release tag (#18)
- Loading branch information
Showing
4 changed files
with
68 additions
and
35 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,49 @@ | ||
#!/usr/bin/env python3 | ||
|
||
|
||
import argparse | ||
import io | ||
import os | ||
|
||
GIT_REF_PREFIX = "refs/tags/" | ||
|
||
|
||
def github_ref_type(value: str) -> str: | ||
if not value.startswith(GIT_REF_PREFIX): | ||
raise ValueError("Invalid GITHUB_REF format, expects `refs/tags/<tag name>`") | ||
|
||
return value | ||
|
||
|
||
def write_about_file(file: io.TextIOWrapper, git_ref: str) -> None: | ||
tag = git_ref[len(GIT_REF_PREFIX) :] | ||
value = f'__version__ = "{tag}"' | ||
print(value, file=file) | ||
return tag | ||
|
||
|
||
def main() -> None: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"GITHUB_REF", | ||
default=os.environ.get("GITHUB_REF"), | ||
type=github_ref_type, | ||
help=( | ||
'The Git reference, like "refs/tags/<tag name>". ' | ||
"Read automatically the GITHUB_REF environment variable, if possible." | ||
), | ||
) | ||
parser.add_argument( | ||
"-f", | ||
"--filename", | ||
default="structlog_gcp/__about__.py", | ||
type=argparse.FileType("w"), | ||
help="The file to write the version into.", | ||
) | ||
args = parser.parse_args() | ||
|
||
write_about_file(args.filename, args.GITHUB_REF) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,6 @@ | ||
# For Developers | ||
|
||
## How to release? | ||
|
||
* Create a new GitHub Release | ||
* Publish the release |
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 +1 @@ | ||
__version__ = "0.2.1" | ||
__version__ = "0.0.1.dev" # Will be overwritten during deployment |