From 07681aa365b596f5b70f1fd6424ba3014c2f0537 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 11:01:20 +0000 Subject: [PATCH 01/16] Add publish.yml --- .github/workflows/publish.yml | 153 ++++++++++++++++++++++++++++++++++ template/__init__.py | 2 +- 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e345393 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,153 @@ +# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license + +# Publish pip package to PyPI https://pypi.org/project/ultralytics-template/ + +name: Publish to PyPI + +on: + push: + branches: [main] + workflow_dispatch: + inputs: + pypi: + type: boolean + description: Publish to PyPI + +jobs: + check: + if: github.repository == 'ultralytics/template' && github.actor == 'glenn-jocher' + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + increment: ${{ steps.check_pypi.outputs.increment }} + current_tag: ${{ steps.check_pypi.outputs.current_tag }} + previous_tag: ${{ steps.check_pypi.outputs.previous_tag }} + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + - uses: astral-sh/setup-uv@v7 + - run: uv pip install --system --no-cache ultralytics-actions + - id: check_pypi + shell: python + run: | + import os + from actions.utils import check_pypi_version + local_version, online_version, publish = check_pypi_version() + os.system(f'echo "increment={publish}" >> $GITHUB_OUTPUT') + os.system(f'echo "current_tag=v{local_version}" >> $GITHUB_OUTPUT') + os.system(f'echo "previous_tag=v{online_version}" >> $GITHUB_OUTPUT') + if publish: + print('Ready to publish new version to PyPI ✅.') + - name: Tag and Release + if: steps.check_pypi.outputs.increment == 'True' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CURRENT_TAG: ${{ steps.check_pypi.outputs.current_tag }} + PREVIOUS_TAG: ${{ steps.check_pypi.outputs.previous_tag }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + run: | + git config --global user.name "UltralyticsAssistant" + git config --global user.email "web@ultralytics.com" + git tag -a "$CURRENT_TAG" -m "$(git log -1 --pretty=%B)" + git push origin "$CURRENT_TAG" + ultralytics-actions-summarize-release + uv cache prune --ci + + build: + needs: check + if: needs.check.outputs.increment == 'True' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + - uses: astral-sh/setup-uv@v7 + - run: uv pip install --system --no-cache build + - run: python -m build + - uses: actions/upload-artifact@v5 + with: + name: dist + path: dist/ + - run: uv cache prune --ci + + publish: + needs: [check, build] + if: needs.check.outputs.increment == 'True' + runs-on: ubuntu-latest + environment: # for GitHub Deployments tab + name: Release - PyPI + url: https://pypi.org/p/ultralytics-template + permissions: + id-token: write # for PyPI trusted publishing + steps: + - uses: actions/download-artifact@v6 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1 + + sbom: + needs: [check, build, publish] + if: needs.check.outputs.increment == 'True' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + - uses: astral-sh/setup-uv@v7 + - run: | + uv venv sbom-env + uv pip install -e . + env: + VIRTUAL_ENV: sbom-env + - uses: anchore/sbom-action@v0 + with: + format: spdx-json + output-file: sbom.spdx.json + path: sbom-env + - run: gh release upload ${{ needs.check.outputs.current_tag }} sbom.spdx.json + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + notify: + needs: [check, publish] + if: always() && needs.check.outputs.increment == 'True' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v5 + - name: Extract PR Details + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + 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' | sed 's/"/\\"/g') + echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_ENV}" + echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_ENV}" + - name: Notify Success + if: needs.publish.result == 'success' && github.event_name == 'push' + uses: slackapi/slack-github-action@v2.1.1 + with: + webhook-type: incoming-webhook + webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} + payload: | + text: " GitHub Actions success for ${{ github.workflow }} ✅\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* NEW `${{ github.repository }} ${{ needs.check.outputs.current_tag }}` pip package published 😃\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ env.PR_TITLE }}\n" + - name: Notify Failure + if: needs.publish.result != 'success' + uses: slackapi/slack-github-action@v2.1.1 + with: + webhook-type: incoming-webhook + webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} + payload: | + text: " GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ env.PR_TITLE }}\n" diff --git a/template/__init__.py b/template/__init__.py index 3691bbc..576ce34 100644 --- a/template/__init__.py +++ b/template/__init__.py @@ -1,3 +1,3 @@ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license -__version__ = "0.0.0" +__version__ = "0.0.1" From f4b64b02a2c06d7113faf356026634b47cf60d71 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 11:52:21 +0000 Subject: [PATCH 02/16] Add publish.yml --- .github/workflows/publish.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e345393..99829fe 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -125,16 +125,13 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v5 - - name: Extract PR Details - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Extract PR Number + id: pr run: | - 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' | sed 's/"/\\"/g') - echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_ENV}" - echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_ENV}" + PR_NUM=$(echo "${{ github.event.head_commit.message }}" | grep -oP '\(#\K\d+(?=\)$)' || echo "N/A") + PR_TITLE=$(echo "${{ github.event.head_commit.message }}" | sed 's/ (#[0-9]\+)$//') + echo "number=${PR_NUM}" >> $GITHUB_OUTPUT + echo "title=${PR_TITLE}" >> $GITHUB_OUTPUT - name: Notify Success if: needs.publish.result == 'success' && github.event_name == 'push' uses: slackapi/slack-github-action@v2.1.1 @@ -142,7 +139,7 @@ jobs: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: " GitHub Actions success for ${{ github.workflow }} ✅\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* NEW `${{ github.repository }} ${{ needs.check.outputs.current_tag }}` pip package published 😃\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ env.PR_TITLE }}\n" + text: " GitHub Actions success for ${{ github.workflow }} ✅\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* NEW `${{ github.repository }} ${{ needs.check.outputs.current_tag }}` pip package published 😃\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ steps.pr.outputs.title }}\n" - name: Notify Failure if: needs.publish.result != 'success' uses: slackapi/slack-github-action@v2.1.1 @@ -150,4 +147,4 @@ jobs: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: " GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ env.PR_TITLE }}\n" + text: " GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ steps.pr.outputs.title }}\n" From fcbd83303ba940dcaf87ef402ec9f8a9dd7acd18 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:04:42 +0000 Subject: [PATCH 03/16] Add publish.yml --- .github/workflows/publish.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 99829fe..a041b4b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -125,26 +125,14 @@ jobs: permissions: contents: read steps: - - name: Extract PR Number - id: pr - run: | - PR_NUM=$(echo "${{ github.event.head_commit.message }}" | grep -oP '\(#\K\d+(?=\)$)' || echo "N/A") - PR_TITLE=$(echo "${{ github.event.head_commit.message }}" | sed 's/ (#[0-9]\+)$//') - echo "number=${PR_NUM}" >> $GITHUB_OUTPUT - echo "title=${PR_TITLE}" >> $GITHUB_OUTPUT - - name: Notify Success - if: needs.publish.result == 'success' && github.event_name == 'push' - uses: slackapi/slack-github-action@v2.1.1 - with: - webhook-type: incoming-webhook - webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} - payload: | - text: " GitHub Actions success for ${{ github.workflow }} ✅\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* NEW `${{ github.repository }} ${{ needs.check.outputs.current_tag }}` pip package published 😃\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ steps.pr.outputs.title }}\n" - - name: Notify Failure - if: needs.publish.result != 'success' + - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 + env: + STATUS: ${{ needs.publish.result == 'success' && '✅' || '❌' }} + MESSAGE: ${{ needs.publish.result == 'success' && format('NEW `{0} {1}` pip package published 😃', github.repository, needs.check.outputs.current_tag) || github.event_name }} + PR_INFO: ${{ github.event.head_commit.message }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: " GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n*Job Status:* ${{ job.status }}\n*Pull Request:* ${{ steps.pr.outputs.title }}\n" + text: " GitHub Actions ${{ needs.publish.result == 'success' && 'success' || 'error' }} for ${{ github.workflow }} ${{ env.STATUS }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ env.MESSAGE }}\n*Job Status:* ${{ job.status }}\n*Commit:* ${{ env.PR_INFO }}\n" From 35211c3d4c0ed84a8be52ffa2c859f34403fd05c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:05:47 +0000 Subject: [PATCH 04/16] Add publish.yml --- .github/workflows/publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a041b4b..7f62f44 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -130,9 +130,8 @@ jobs: env: STATUS: ${{ needs.publish.result == 'success' && '✅' || '❌' }} MESSAGE: ${{ needs.publish.result == 'success' && format('NEW `{0} {1}` pip package published 😃', github.repository, needs.check.outputs.current_tag) || github.event_name }} - PR_INFO: ${{ github.event.head_commit.message }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: " GitHub Actions ${{ needs.publish.result == 'success' && 'success' || 'error' }} for ${{ github.workflow }} ${{ env.STATUS }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ env.MESSAGE }}\n*Job Status:* ${{ job.status }}\n*Commit:* ${{ env.PR_INFO }}\n" + text: " GitHub Actions ${{ needs.publish.result == 'success' && 'success' || 'error' }} for ${{ github.workflow }} ${{ env.STATUS }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ env.MESSAGE }}\n*Job Status:* ${{ job.status }}\n*Commit:* \n" From 107b986d7f5ea464f5b383e7fea8da97902c306e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:23:30 +0000 Subject: [PATCH 05/16] Add publish.yml --- .github/workflows/publish.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7f62f44..d028fb2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -127,11 +127,8 @@ jobs: steps: - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 - env: - STATUS: ${{ needs.publish.result == 'success' && '✅' || '❌' }} - MESSAGE: ${{ needs.publish.result == 'success' && format('NEW `{0} {1}` pip package published 😃', github.repository, needs.check.outputs.current_tag) || github.event_name }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: " GitHub Actions ${{ needs.publish.result == 'success' && 'success' || 'error' }} for ${{ github.workflow }} ${{ env.STATUS }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ env.MESSAGE }}\n*Job Status:* ${{ job.status }}\n*Commit:* \n" + text: "${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.check.outputs.current_tag, github.event.repository.name) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" From c44df8469dd6a1419eb08313ea6eb6cd74645b99 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:25:04 +0000 Subject: [PATCH 06/16] Add publish.yml --- .github/workflows/publish.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d028fb2..e2f5b84 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -127,8 +127,11 @@ jobs: steps: - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 + env: + PYPI_URL: https://pypi.org/p/${{ replace(github.repository, '/', '-') }} + TITLE: ${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.check.outputs.current_tag, replace(github.repository, '/', '-')) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: "${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.check.outputs.current_tag, github.event.repository.name) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" + text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" From 8a50c1b2b3016d39555afa36e421bca8d0ca96fb Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:26:18 +0000 Subject: [PATCH 07/16] Add publish.yml --- .github/workflows/test-notify.yml | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/test-notify.yml diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml new file mode 100644 index 0000000..151461a --- /dev/null +++ b/.github/workflows/test-notify.yml @@ -0,0 +1,53 @@ +# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license + +# Test Slack notification logic + +name: Test Notify + +on: + workflow_dispatch: + inputs: + simulate_success: + type: boolean + description: Simulate success (true) or failure (false) + default: true + +jobs: + mock_check: + runs-on: ubuntu-latest + outputs: + increment: "True" + current_tag: v1.0.0 + previous_tag: v0.9.9 + steps: + - run: echo "Mock check job" + + mock_publish: + needs: mock_check + runs-on: ubuntu-latest + steps: + - run: | + if [ "${{ github.event.inputs.simulate_success }}" = "true" ]; then + echo "Simulating success" + exit 0 + else + echo "Simulating failure" + exit 1 + fi + + notify: + needs: [mock_check, mock_publish] + if: always() && needs.mock_check.outputs.increment == 'True' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Notify Slack + uses: slackapi/slack-github-action@v2.1.1 + env: + TITLE: ${{ needs.mock_publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.mock_check.outputs.current_tag, replace(github.repository, '/', '-')) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} + with: + webhook-type: incoming-webhook + webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} + payload: | + text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" From 783e82a0f5fe6b530d37225231fe38c3ac0e0b9d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:28:37 +0000 Subject: [PATCH 08/16] Add publish.yml --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e2f5b84..ce9f774 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,7 @@ jobs: increment: ${{ steps.check_pypi.outputs.increment }} current_tag: ${{ steps.check_pypi.outputs.current_tag }} previous_tag: ${{ steps.check_pypi.outputs.previous_tag }} + pypi_url: https://pypi.org/p/ultralytics-template steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 @@ -82,7 +83,7 @@ jobs: runs-on: ubuntu-latest environment: # for GitHub Deployments tab name: Release - PyPI - url: https://pypi.org/p/ultralytics-template + url: ${{ needs.check.outputs.pypi_url }} permissions: id-token: write # for PyPI trusted publishing steps: @@ -128,8 +129,7 @@ jobs: - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 env: - PYPI_URL: https://pypi.org/p/${{ replace(github.repository, '/', '-') }} - TITLE: ${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.check.outputs.current_tag, replace(github.repository, '/', '-')) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} + TITLE: ${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.check.outputs.current_tag, needs.check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} From 58f73ea07f0571049599388cd5c952f11486c2c3 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:28:44 +0000 Subject: [PATCH 09/16] Add publish.yml --- .github/workflows/test-notify.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index 151461a..0a9add3 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -19,6 +19,7 @@ jobs: increment: "True" current_tag: v1.0.0 previous_tag: v0.9.9 + pypi_url: https://pypi.org/p/ultralytics-template steps: - run: echo "Mock check job" @@ -45,7 +46,7 @@ jobs: - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 env: - TITLE: ${{ needs.mock_publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.mock_check.outputs.current_tag, replace(github.repository, '/', '-')) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} + TITLE: ${{ needs.mock_publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.mock_check.outputs.current_tag, needs.mock_check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} From ecedc1e5b4e4330dea135f666073e2baf255682e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:31:35 +0000 Subject: [PATCH 10/16] Add publish.yml --- .github/workflows/test-notify.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index 0a9add3..da9ae12 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -5,6 +5,7 @@ name: Test Notify on: + push: workflow_dispatch: inputs: simulate_success: From fbdecc6323ef243eefb2ecf16e3e4aa694ba742c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:35:27 +0000 Subject: [PATCH 11/16] Add publish.yml --- .github/workflows/test-notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index da9ae12..dd6aef2 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -11,7 +11,7 @@ on: simulate_success: type: boolean description: Simulate success (true) or failure (false) - default: true + default: false jobs: mock_check: From f7dbf0797c48d13a84f6669c3411651d59b5b7a2 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:35:59 +0000 Subject: [PATCH 12/16] Add publish.yml --- .github/workflows/test-notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index dd6aef2..3e69c15 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -50,6 +50,6 @@ jobs: TITLE: ${{ needs.mock_publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.mock_check.outputs.current_tag, needs.mock_check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} with: webhook-type: incoming-webhook - webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} + webhook: ${{ secrets.SLACK_WEBHOOK_URL_LLM }} payload: | text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" From 0fa622e2725960a3dae95aab4251ed65acf3ccbe Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 12:36:07 +0000 Subject: [PATCH 13/16] Add publish.yml --- .github/workflows/test-notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index 3e69c15..cfce8b8 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -11,7 +11,7 @@ on: simulate_success: type: boolean description: Simulate success (true) or failure (false) - default: false + default: true jobs: mock_check: From 8f174971688d203b86abdb289ab46d46df900532 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 13:01:56 +0000 Subject: [PATCH 14/16] Add publish.yml --- .github/workflows/test-notify.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index cfce8b8..a9b0bec 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -44,6 +44,9 @@ jobs: permissions: contents: read steps: + - name: Get short SHA + id: sha + run: echo "short=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 env: @@ -52,4 +55,4 @@ jobs: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_LLM }} payload: | - text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" + text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*Commit:* ${{ github.event.head_commit.message }}\n" From 28cfd5b530dc8bcf8a9d84b7b28984c6f047ad84 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 13:04:46 +0000 Subject: [PATCH 15/16] Add publish.yml --- .github/workflows/publish.yml | 7 +++++-- .github/workflows/test-notify.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ce9f774..8c5addb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -126,12 +126,15 @@ jobs: permissions: contents: read steps: + - name: Get short SHA + id: sha + run: echo "short=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 env: - TITLE: ${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.check.outputs.current_tag, needs.check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} + TITLE: ${{ needs.publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, needs.publish.result, github.workflow, needs.check.outputs.current_tag, needs.check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, needs.publish.result, github.workflow) }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }} payload: | - text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*:* ${{ github.event.head_commit.message }}\n" + text: "${{ env.TITLE }}\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Author:* ${{ github.actor }}\n*Commit:* ${{ github.event.head_commit.message }}\n" diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index a9b0bec..2b56872 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -50,7 +50,7 @@ jobs: - name: Notify Slack uses: slackapi/slack-github-action@v2.1.1 env: - TITLE: ${{ needs.mock_publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, job.status, github.workflow, needs.mock_check.outputs.current_tag, needs.mock_check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, job.status, github.workflow) }} + TITLE: ${{ needs.mock_publish.result == 'success' && format(' {2} {3} for {4} ✅\nNEW `{0} {5}` <{6}|package> published 😃', github.repository, github.run_id, github.event_name, needs.mock_publish.result, github.workflow, needs.mock_check.outputs.current_tag, needs.mock_check.outputs.pypi_url) || format(' {2} {3} for {4} ❌', github.repository, github.run_id, github.event_name, needs.mock_publish.result, github.workflow) }} with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK_URL_LLM }} From cb08f3e01f7f79bec9ed1dc0da420e18f4b33b31 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 11 Nov 2025 13:07:00 +0000 Subject: [PATCH 16/16] Add publish.yml --- .github/workflows/test-notify.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-notify.yml b/.github/workflows/test-notify.yml index 2b56872..567e189 100644 --- a/.github/workflows/test-notify.yml +++ b/.github/workflows/test-notify.yml @@ -29,12 +29,12 @@ jobs: runs-on: ubuntu-latest steps: - run: | - if [ "${{ github.event.inputs.simulate_success }}" = "true" ]; then - echo "Simulating success" - exit 0 - else + if [ "${{ github.event.inputs.simulate_success || 'true' }}" = "false" ]; then echo "Simulating failure" exit 1 + else + echo "Simulating success" + exit 0 fi notify: