Skip to content

Commit 5a0da66

Browse files
committed
Fixing publish/split workflow
1 parent 1936b18 commit 5a0da66

File tree

1 file changed

+53
-46
lines changed

1 file changed

+53
-46
lines changed

.github/workflows/split.yml

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,54 @@ on:
33
push:
44
tags: ['v*']
55

6-
env:
7-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
6+
permissions:
7+
contents: write
8+
9+
#env:
10+
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
811

912
jobs:
1013
split:
1114
runs-on: ubuntu-latest
1215
strategy:
1316
fail-fast: false
1417
matrix:
15-
package:
16-
- local: 'packages/addons'
17-
repo: 'cognesy/instructor-addons'
18-
name: 'instructor-addons'
19-
- local: 'packages/auxiliary'
20-
repo: 'cognesy/instructor-aux'
21-
name: 'instructor-aux'
22-
- local: 'packages/http-client'
23-
repo: 'cognesy/instructor-http-client'
24-
name: 'instructor-http-client'
25-
- local: 'packages/hub'
26-
repo: 'cognesy/instructor-hub'
27-
name: 'instructor-hub'
28-
- local: 'packages/instructor'
29-
repo: 'cognesy/instructor-struct'
30-
name: 'instructor-struct'
31-
- local: 'packages/polyglot'
32-
repo: 'cognesy/instructor-polyglot'
33-
name: 'instructor-polyglot'
34-
- local: 'packages/setup'
35-
repo: 'cognesy/instructor-setup'
36-
name: 'instructor-setup'
37-
- local: 'packages/tell'
38-
repo: 'cognesy/instructor-tell'
39-
name: 'instructor-tell'
40-
- local: 'packages/utils'
41-
repo: 'cognesy/instructor-utils'
42-
name: 'instructor-utils'
18+
include:
19+
- local: packages/addons
20+
repo: cognesy/instructor-addons
21+
name: instructor-addons
22+
23+
- local: packages/auxiliary
24+
repo: cognesy/instructor-aux
25+
name: instructor-aux
26+
27+
- local: packages/http-client
28+
repo: cognesy/instructor-http-client
29+
name: instructor-http-client
30+
31+
- local: packages/hub
32+
repo: cognesy/instructor-hub
33+
name: instructor-hub
34+
35+
- local: packages/instructor
36+
repo: cognesy/instructor-struct
37+
name: instructor-struct
38+
39+
- local: packages/polyglot
40+
repo: cognesy/instructor-polyglot
41+
name: instructor-polyglot
42+
43+
- local: packages/setup
44+
repo: cognesy/instructor-setup
45+
name: instructor-setup
46+
47+
- local: packages/tell
48+
repo: cognesy/instructor-tell
49+
name: instructor-tell
50+
51+
- local: packages/utils
52+
repo: cognesy/instructor-utils
53+
name: instructor-utils
4354

4455
steps:
4556
- uses: actions/checkout@v4
@@ -48,27 +59,22 @@ jobs:
4859

4960
# Verify release notes exist for this package
5061
- name: Verify release notes
51-
id: check_notes
5262
run: |
53-
TAG_NAME=${{ github.ref_name }}
54-
NOTES_PATH="${{ matrix.package.local }}/release_notes/${TAG_NAME}.md"
55-
56-
if [ -f "$NOTES_PATH" ]; then
57-
echo "NOTES_EXIST=true" >> $GITHUB_ENV
58-
echo "Notes found at $NOTES_PATH"
63+
TAG=${{ github.ref_name }} # v0.13.2
64+
NOTES={{ matrix.local }}/release_notes/${TAG}.md
65+
if [[ -f "$NOTES" ]]; then
66+
echo "release notes found: $NOTES"
5967
else
60-
echo "NOTES_EXIST=false" >> $GITHUB_ENV
61-
echo "Warning: No release notes found at $NOTES_PATH"
62-
# Create a minimal release note if none exists
63-
mkdir -p "${{ matrix.package.local }}/release_notes"
64-
echo "# ${TAG_NAME}\n\nThis release is part of the main monorepo release ${TAG_NAME}." > "$NOTES_PATH"
65-
echo "Created minimal release notes"
68+
echo "no notes – creating stub → $NOTES"
69+
mkdir -p "$(dirname "$NOTES")"
70+
printf '# %s\n\nSplit release of %s.\n' "$TAG" "${{ matrix.name }}" > "$NOTES"
6671
fi
6772
6873
# ► push branch + tag
6974
- name: Split Monorepo
7075
uses: "danharrin/monorepo-split-github-action@v2.3.0"
7176
with:
77+
github_token: ${{ secrets.SPLIT_TOKEN }} # PAT here
7278
tag: ${{ github.ref_name }} # e.g. v1.2.3
7379
package_directory: ${{ matrix.package.local }}
7480
repository_organization: cognesy
@@ -77,11 +83,12 @@ jobs:
7783
user_email: 'ci@cognesy.com'
7884

7985
# ► create GitHub Release with notes
80-
- uses: softprops/action-gh-release@v2
86+
- name: Publish GitHub release
87+
uses: softprops/action-gh-release@v2
8188
if: github.ref_type == 'tag'
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN }} # PAT once for all API calls
8291
with:
8392
repository: ${{ matrix.package.repo }} # target repo
8493
tag_name: ${{ github.ref_name }} # v1.2.3
8594
body_path: ${{ matrix.package.local }}/release_notes/${{ github.ref_name }}.md
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

0 commit comments

Comments
 (0)