Skip to content

Commit

Permalink
Publisher support google artifacts repository (#836)
Browse files Browse the repository at this point in the history
* Publisher support google artifacts repository

* add release note

---------

Co-authored-by: Ofek Lev <[email protected]>
  • Loading branch information
ischaojie and ofek authored Nov 27, 2023
1 parent 78a8803 commit 3321f08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/history/hatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix nushell activation
- Better handling of flat storage directory hierarchies for the `virtual` environment type
- Display useful information when running the `version` command outside of a project rather than erroring
- Properly support Google Artifact Registry

## [1.7.0](https://github.com/pypa/hatch/releases/tag/hatch-v1.7.0) - 2023-04-03 ## {: #hatch-v1.7.0 }

Expand Down
13 changes: 9 additions & 4 deletions src/hatch/publish/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@ def publish(self, artifacts: list, options: dict):
if not user:
user = cached_user_file.get_user(repo)
if user is None:
if options['no_prompt']:
self.app.abort('Missing required option: user')
else:
user = updated_user = self.app.prompt('Enter your username', default='__TOKEN__')
import keyring

creds = keyring.get_credential(repo, None)
user = creds and creds.username
if user is None:
if options['no_prompt']:
self.app.abort('Missing required option: user')
else:
user = updated_user = self.app.prompt('Enter your username', default='__TOKEN__')
index.user = user

updated_auth = None
Expand Down

0 comments on commit 3321f08

Please sign in to comment.