forked from Lyken17/pytorch-OpCounter
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Glenn Jocher <[email protected]>
- Loading branch information
1 parent
8e95579
commit 97e423f
Showing
1 changed file
with
17 additions
and
25 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 |
---|---|---|
|
@@ -35,11 +35,9 @@ jobs: | |
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
cache: "pip" | ||
- uses: astral-sh/setup-uv@v4 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
pip install ultralytics-actions build twine toml | ||
run: uv pip install --system --no-cache ultralytics-actions build twine toml | ||
- name: Check PyPI version | ||
shell: python | ||
run: | | ||
|
@@ -52,12 +50,21 @@ jobs: | |
if publish: | ||
print('Ready to publish new version to PyPI ✅.') | ||
id: check_pypi | ||
- name: Build package | ||
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True' | ||
run: python -m build | ||
- name: Publish to PyPI | ||
continue-on-error: true | ||
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True' | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Publish new tag | ||
continue-on-error: true | ||
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True' | ||
run: | | ||
git tag -a "${{ steps.check_pypi.outputs.current_tag }}" -m "$(git log -1 --pretty=%B)" # i.e. "v0.1.2 commit message" | ||
git push origin "${{ steps.check_pypi.outputs.current_tag }}" | ||
- name: Publish new release | ||
continue-on-error: true | ||
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True' | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
@@ -66,30 +73,15 @@ jobs: | |
PREVIOUS_TAG: ${{ steps.check_pypi.outputs.previous_tag }} | ||
run: ultralytics-actions-summarize-release | ||
shell: bash | ||
- name: Build package | ||
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True' | ||
run: python -m build | ||
- name: Publish to PyPI | ||
continue-on-error: true | ||
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True' | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Extract PR Details | ||
env: | ||
GH_TOKEN: ${{ secrets._GITHUB_TOKEN }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Check if the event is a pull request or pull_request_target | ||
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq '.title') | ||
else | ||
# Use gh to find the PR associated with the commit | ||
COMMIT_SHA=${{ github.event.after }} | ||
PR_JSON=$(gh pr list --search "${COMMIT_SHA}" --state merged --json number,title --jq '.[0]') | ||
PR_NUMBER=$(echo $PR_JSON | jq -r '.number') | ||
PR_TITLE=$(echo $PR_JSON | jq -r '.title') | ||
fi | ||
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | ||
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV | ||
PR_JSON=$(gh pr list --search "${GITHUB_SHA}" --state merged --json number,title --jq '.[0]') | ||
PR_NUMBER=$(echo "${PR_JSON}" | jq -r '.number') | ||
PR_TITLE=$(echo "${PR_JSON}" | jq -r '.title') | ||
echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_ENV}" | ||
echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_ENV}" | ||
- name: Notify on Slack (Success) | ||
if: success() && github.event_name == 'push' && steps.check_pypi.outputs.increment == 'True' | ||
uses: slackapi/[email protected] | ||
|