@@ -18,20 +18,21 @@ jobs:
18
18
- name : Find package directories
19
19
id : set-matrix
20
20
run : |
21
+ # Find all package.json and pyproject.toml files, excluding root
21
22
DIRS=$(git ls-tree -r HEAD --name-only | grep -E "package.json|pyproject.toml" | xargs dirname | grep -v "^.$" | jq -R -s -c 'split("\n")[:-1]')
22
23
echo "matrix=${DIRS}" >> $GITHUB_OUTPUT
24
+ echo "Found directories: ${DIRS}"
23
25
24
26
- name : Get last release hash
25
27
id : last-release
26
28
run : |
27
29
HASH=$(git rev-list --tags --max-count=1 || echo "HEAD~1")
28
30
echo "hash=${HASH}" >> $GITHUB_OUTPUT
31
+ echo "Using last release hash: ${HASH}"
29
32
30
33
check-release :
31
34
needs : prepare
32
35
runs-on : ubuntu-latest
33
- outputs :
34
- release : ${{ steps.check.outputs.release }}
35
36
strategy :
36
37
matrix :
37
38
directory : ${{ fromJson(needs.prepare.outputs.matrix) }}
@@ -45,46 +46,114 @@ jobs:
45
46
- uses : astral-sh/setup-uv@v5
46
47
47
48
- name : Setup Node.js
48
- if : endsWith(matrix.directory, 'package.json')
49
+ if : endsWith(matrix.directory, '/ package.json')
49
50
uses : actions/setup-node@v4
50
51
with :
51
52
node-version : ' 18'
52
53
53
54
- name : Setup Python
54
- if : endsWith(matrix.directory, 'pyproject.toml')
55
+ if : endsWith(matrix.directory, '/ pyproject.toml')
55
56
run : uv python install
56
57
57
58
- name : Check release
58
59
id : check
59
60
run : |
60
- output=$(uv run --script scripts/release.py --dry-run "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}" \
61
- | grep -o -E "[a-zA-Z0-9\-]+@[0-9]+\.[0-9]+\.[0-9]+" || true)
62
- if [ ! -z "$output" ]; then
63
- echo "release<<EOF" >> $GITHUB_OUTPUT
64
- echo "$output" >> $GITHUB_OUTPUT
65
- echo "EOF" >> $GITHUB_OUTPUT
61
+ # Create unique hash for this directory
62
+ dir_hash=$(echo "${{ matrix.directory }}" | sha256sum | awk '{print $1}')
63
+
64
+ # Run release check script with verbose output
65
+ echo "Running release check against last release: ${{ needs.prepare.outputs.last_release }}"
66
+
67
+ # Run git diff first to show changes
68
+ echo "Changes since last release:"
69
+ git diff --name-only "${{ needs.prepare.outputs.last_release }}" -- "${{ matrix.directory }}" || true
70
+
71
+ # Run the release check
72
+ output=$(uv run --script scripts/release.py --dry-run "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}" 2>&1)
73
+ exit_code=$?
74
+
75
+ echo "Release check output (exit code: $exit_code):"
76
+ echo "$output"
77
+
78
+ # Extract package info if successful
79
+ if [ $exit_code -eq 0 ]; then
80
+ pkg_info=$(echo "$output" | grep -o -E "[a-zA-Z0-9\-]+@[0-9]+\.[0-9]+\.[0-9]+" || true)
81
+ else
82
+ echo "Release check failed"
83
+ exit 1
84
+ fi
85
+
86
+ if [ ! -z "$pkg_info" ]; then
87
+ echo "Found package that needs release: $pkg_info"
88
+
89
+ # Create outputs directory
90
+ mkdir -p ./outputs
91
+
92
+ # Save both package info and full changes
93
+ echo "$pkg_info" > "./outputs/${dir_hash}_info"
94
+ echo "dir_hash=${dir_hash}" >> $GITHUB_OUTPUT
95
+
96
+ # Log what we're saving
97
+ echo "Saved package info to ./outputs/${dir_hash}_info:"
98
+ cat "./outputs/${dir_hash}_info"
99
+ else
100
+ echo "No release needed for this package"
66
101
fi
67
102
103
+ - name : Set artifact name
104
+ if : steps.check.outputs.dir_hash
105
+ id : artifact
106
+ run : |
107
+ # Replace forward slashes with dashes
108
+ SAFE_DIR=$(echo "${{ matrix.directory }}" | tr '/' '-')
109
+ echo "name=release-outputs-${SAFE_DIR}" >> $GITHUB_OUTPUT
110
+
111
+ - uses : actions/upload-artifact@v4
112
+ if : steps.check.outputs.dir_hash
113
+ with :
114
+ name : ${{ steps.artifact.outputs.name }}
115
+ path : ./outputs/${{ steps.check.outputs.dir_hash }}*
116
+
68
117
check-tag :
69
118
needs : [prepare, check-release]
70
119
runs-on : ubuntu-latest
71
120
steps :
72
121
- uses : actions/checkout@v4
73
122
123
+ - uses : actions/download-artifact@v4
124
+ with :
125
+ pattern : release-outputs-src-*
126
+ merge-multiple : true
127
+ path : outputs
128
+
74
129
- name : Simulate tag creation
75
130
run : |
76
- echo "${{ needs.check-release.outputs.release }}" > packages.txt
77
- if [ -s packages.txt ]; then
78
- DATE=$(date +%Y.%m.%d)
79
- echo "π Dry run: Would create tag v${DATE} if this was a real release"
80
-
81
- echo "# Release ${DATE}" > notes.md
82
- echo "" >> notes.md
83
- echo "## Updated Packages" >> notes.md
84
- while IFS= read -r line; do
85
- echo "- $line" >> notes.md
86
- done < packages.txt
87
-
88
- echo "π Would create release with following notes:"
89
- cat notes.md
131
+ if [ -d outputs ]; then
132
+ # Collect package info
133
+ find outputs -name "*_info" -exec cat {} \; > packages.txt
134
+
135
+ if [ -s packages.txt ]; then
136
+ DATE=$(date +%Y.%m.%d)
137
+ echo "π Dry run: Would create tag v${DATE} if this was a real release"
138
+
139
+ # Generate comprehensive release notes
140
+ {
141
+ echo "# Release ${DATE}"
142
+ echo ""
143
+ echo "## Updated Packages"
144
+ while IFS= read -r line; do
145
+ echo "- $line"
146
+ done < packages.txt
147
+ } > notes.md
148
+
149
+ echo "π Would create release with following notes:"
150
+ cat notes.md
151
+
152
+ echo "π Would create tag v${DATE} with the above release notes"
153
+ echo "π Would create GitHub release from tag v${DATE}"
154
+ else
155
+ echo "No packages need release"
156
+ fi
157
+ else
158
+ echo "No release artifacts found"
90
159
fi
0 commit comments