-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (115 loc) · 4.21 KB
/
main.yml
File metadata and controls
140 lines (115 loc) · 4.21 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI/CD with Auto Release
on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main ]
permissions:
contents: write # Allow creating tags and releases
actions: read # Allow reading workflow runs
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 -m pip install -e ".[dev]" --break-system-packages
- name: Run parity tests
run: |
python3 -m pytest tests/integration/parity/ -v --tb=short
- name: Generate parity matrix
if: always()
run: |
python3 scripts/generate_parity_matrix.py || echo "Parity matrix generation failed (script may not exist yet)"
- name: Upload parity matrix
if: always()
uses: actions/upload-artifact@v4
with:
name: parity-matrix
path: docs/mcp-rest-parity-matrix.md
if-no-files-found: ignore
check-version:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check_version.outputs.version_changed }}
current_version: ${{ steps.check_version.outputs.current_version }}
previous_version: ${{ steps.check_version.outputs.previous_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current version
id: get_version
run: |
echo "current_version=$(python3 -c "import sys; sys.path.insert(0, 'src'); from code_indexer import __version__; print(__version__)")" >> $GITHUB_OUTPUT
- name: Check if version file changed
run: |
if git diff --name-only HEAD~1 HEAD | grep -q "src/code_indexer/__init__.py"; then
echo "version_file_changed=true" >> $GITHUB_ENV
else
echo "version_file_changed=false" >> $GITHUB_ENV
fi
- name: Get previous version
if: env.version_file_changed == 'true'
run: |
echo "previous_version=$(git show HEAD~1:src/code_indexer/__init__.py | grep '__version__' | cut -d'\"' -f2)" >> $GITHUB_ENV
- name: Check if version changed
id: check_version
run: |
current_version="${{ steps.get_version.outputs.current_version }}"
echo "current_version=$current_version" >> $GITHUB_OUTPUT
if [ "${{ env.version_file_changed }}" = "true" ]; then
previous_version="${{ env.previous_version }}"
echo "previous_version=$previous_version" >> $GITHUB_OUTPUT
if [ "$current_version" != "$previous_version" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "Version changed from $previous_version to $current_version"
else
echo "version_changed=false" >> $GITHUB_OUTPUT
echo "Version file modified but version unchanged: $current_version"
fi
else
echo "version_changed=false" >> $GITHUB_OUTPUT
echo "Version file not modified: $current_version"
fi
build-and-release:
runs-on: ubuntu-latest
needs: [check-version]
if: needs.check-version.outputs.version_changed == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python3 -m pip install build twine --break-system-packages
- name: Build package
run: |
python3 -m build
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Extract version
VERSION="${{ needs.check-version.outputs.current_version }}"
# Create git tag
git config user.name github-actions
git config user.email github-actions@github.com
git tag "v$VERSION" -m "Release version $VERSION"
git push origin "v$VERSION"
# Create GitHub release with auto-generated notes
gh release create "v$VERSION" \
--title "Release v$VERSION" \
--generate-notes \
--draft=false \
--prerelease=false \
dist/*