Skip to content

{CI} Auto create release tag.#8392

Merged
wangzelin007 merged 5 commits intoAzure:mainfrom
wangzelin007:create-release-tag
Jan 10, 2025
Merged

{CI} Auto create release tag.#8392
wangzelin007 merged 5 commits intoAzure:mainfrom
wangzelin007:create-release-tag

Conversation

@wangzelin007
Copy link
Member

@wangzelin007 wangzelin007 commented Jan 2, 2025

image
All releases:
https://github.com/Azure/azure-cli-extensions/releases
All tags:
https://github.com/Azure/azure-cli-extensions/tags
This PR will automatically create tags and releases based on the modifications in index.json:

  • Supports creating multiple tags and releases at once.
  • Supports modifying index.json to synchronize changes to tags and releases.
  • Supports modifying sha256 to synchronize changes to the release sha256 and re-upload the wheel package.

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jan 2, 2025

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd
Copy link

Hi @wangzelin007,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2025

🚫All pull requests will be blocked to merge until Jan 6, 2025 due to CCOA

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 2, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2025

@wangzelin007 wangzelin007 requested review from AllyW and MoChilia January 6, 2025 06:04
if not filenames:
print("No filenames found in changes")
shas = parse_sha256_digest(added_lines)
if not shas:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone only modify the SHA, we need to update the tag, release, and re-upload the wheel package.


print(f"Found {len(filenames)} files to process")
# Process each filename
for filename in filenames:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since multiple extensions can be released at once, multi-version GitHub release is necessary.

extension_name = re.match(r"^(.*?)[-_]\d+\.\d+\.\d+", filename).group(1)
history_note = get_history_note_from_source(version, extension_name)

# If no notes found in source code, try wheel package
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, retrieve the history note from the source code. If it is not available, get it from the wheel package. If it is still not available, use the default history note.

def update_release_body(release_id: int, commit_sha: str, old_body: str, sha: str, tag_name: str) -> bool:
try:
url = f"{base_url}/releases/{release_id}"
ref_url = f"{base_url}/git/refs/tags/{tag_name}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is not possible to directly modify the relationship between the tag and commit in the release, I can only call the update ref API first to modify the corresponding relationship between the tag and commit.

wheel_response = requests.get(wheel_url)
wheel_response.raise_for_status()

if asset_id is not None:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not possible to directly overwrite the previous wheel package; I can only delete it first and then re-upload it.

@wangzelin007 wangzelin007 merged commit b3c5507 into Azure:main Jan 10, 2025
22 checks passed
Jenniferyingni pushed a commit to Jenniferyingni/azure-cli-extensions that referenced this pull request Feb 9, 2025
* create release tag

* update

* update

* update

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants