generated from ultralytics/template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (67 loc) · 2.45 KB
/
tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Ultralytics 🚀 - AGPL-3.0 License https://ultralytics.com/license
# Ultralytics Actions https://github.com/ultralytics/actions
# This workflow automatically publishes a new repository tag and release
name: Tag and Release
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name (e.g., v0.0.0)'
required: true
type: string
publish_tag:
description: 'Publish new tag'
required: true
type: boolean
default: true
publish_release:
description: 'Publish new release'
required: true
type: boolean
default: true
jobs:
tag-and-release:
if: github.repository == 'ultralytics/handbook' && github.actor == 'glenn-jocher'
name: Tag and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Git config
run: |
git config --global user.name "UltralyticsAssistant"
git config --global user.email "[email protected]"
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse ${{ github.event.inputs.tag_name }} >/dev/null 2>&1; then
echo "Tag ${{ github.event.inputs.tag_name }} already exists"
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "Tag ${{ github.event.inputs.tag_name }} does not exist"
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi
- name: Publish new tag
if: steps.check_tag.outputs.tag_exists == 'false'
run: |
git tag -a "${{ github.event.inputs.tag_name }}" -m "$(git log -1 --pretty=%B)"
git push origin "${{ github.event.inputs.tag_name }}"
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install requests
- name: Publish new release
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
CURRENT_TAG: ${{ github.event.inputs.tag_name }}
run: |
curl -s "https://raw.githubusercontent.com/ultralytics/actions/main/utils/summarize_release.py" | python -
shell: bash