-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (149 loc) · 5.57 KB
/
release.yml
File metadata and controls
178 lines (149 loc) · 5.57 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release to PyPI
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
type: string
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Extract version from tag or input
id: version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
VERSION=${GITHUB_REF#refs/tags/v}
VERSION=${VERSION#refs/tags/}
else
VERSION="${{ github.event.inputs.version }}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Update version in pyproject.toml
run: |
VERSION="${{ steps.version.outputs.version }}"
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
- name: Update version in __init__.py
run: |
VERSION="${{ steps.version.outputs.version }}"
sed -i "s/^__version__ = \".*\"/__version__ = \"$VERSION\"/" sentience/__init__.py
- name: Verify extension files are present
run: |
echo "🔍 Verifying extension files are included..."
# Check required extension files exist
REQUIRED_FILES=(
"sentience/extension/manifest.json"
"sentience/extension/content.js"
"sentience/extension/background.js"
"sentience/extension/injected_api.js"
"sentience/extension/pkg/sentience_core.js"
"sentience/extension/pkg/sentience_core_bg.wasm"
)
MISSING_FILES=()
for file in "${REQUIRED_FILES[@]}"; do
if [ ! -f "$file" ]; then
MISSING_FILES+=("$file")
fi
done
if [ ${#MISSING_FILES[@]} -ne 0 ]; then
echo "❌ Error: Missing required extension files:"
printf ' - %s\n' "${MISSING_FILES[@]}"
echo ""
echo "Please ensure the extension is synced before releasing."
echo "Run the sync-extension workflow or manually sync extension files."
exit 1
fi
# Verify findTextRect function exists in injected_api.js
if ! grep -q "findTextRect:" sentience/extension/injected_api.js; then
echo "❌ Error: findTextRect function not found in injected_api.js"
echo "The extension may be out of date. Please sync the extension before releasing."
exit 1
fi
echo "✅ All extension files verified"
echo "📦 Extension files that will be included:"
find sentience/extension -type f | sort
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Verify extension files in built package
run: |
echo "🔍 Verifying extension files are included in the built package..."
# Extract wheel to check contents
WHEEL_FILE=$(ls dist/*.whl | head -1)
WHEEL_PATH=$(realpath "$WHEEL_FILE")
echo "Checking wheel: $WHEEL_PATH"
# Create temp directory for extraction
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
# Extract wheel (it's a zip file)
unzip -q "$WHEEL_PATH"
# Check for required extension files in the wheel
REQUIRED_IN_WHEEL=(
"sentience/extension/manifest.json"
"sentience/extension/injected_api.js"
"sentience/extension/pkg/sentience_core.js"
"sentience/extension/pkg/sentience_core_bg.wasm"
)
MISSING_IN_WHEEL=()
for file in "${REQUIRED_IN_WHEEL[@]}"; do
if [ ! -f "$file" ]; then
MISSING_IN_WHEEL+=("$file")
fi
done
if [ ${#MISSING_IN_WHEEL[@]} -ne 0 ]; then
echo "❌ Error: Extension files missing from built wheel:"
printf ' - %s\n' "${MISSING_IN_WHEEL[@]}"
echo ""
echo "This indicates a packaging configuration issue."
echo "Check MANIFEST.in and pyproject.toml package-data settings."
exit 1
fi
# Verify findTextRect is in the packaged injected_api.js
if ! grep -q "findTextRect:" sentience/extension/injected_api.js; then
echo "❌ Error: findTextRect not found in packaged injected_api.js"
exit 1
fi
echo "✅ All extension files verified in built package"
echo "📦 Extension files found in wheel:"
find sentience/extension -type f | sort
# Cleanup
rm -rf "$TEMP_DIR"
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
- name: Create GitHub Release
if: github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
body: |
Release v${{ steps.version.outputs.version }} of sentienceapi
## Installation
```bash
pip install sentienceapi==${{ steps.version.outputs.version }}
```
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}