Skip to content

Commit cade6e4

Browse files
wip test workflow
1 parent d17ac77 commit cade6e4

File tree

5 files changed

+110
-46
lines changed

5 files changed

+110
-46
lines changed

.github/workflows/split.yml

Lines changed: 102 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,57 @@ jobs:
7575
steps:
7676
- uses: actions/checkout@v4
7777

78+
- name: Get package stability and determine version
79+
working-directory: packages/${{ matrix.package }}
80+
id: version
81+
run: |
82+
if [ -f composer.json ]; then
83+
# Extract moox-stability from composer.json
84+
STABILITY=$(jq -r '.extra."moox-stability" // "dev"' composer.json)
85+
BASE_VERSION="${{ needs.prepare.outputs.core-version }}"
86+
87+
echo "Package: ${{ matrix.package }}"
88+
echo "Base version: $BASE_VERSION"
89+
echo "Stability: $STABILITY"
90+
91+
# Determine final version based on stability
92+
if [ "$STABILITY" = "stable" ]; then
93+
FINAL_VERSION="$BASE_VERSION"
94+
IS_PRERELEASE=false
95+
echo "✅ Using stable version: $FINAL_VERSION"
96+
elif [ "$STABILITY" = "dev" ]; then
97+
FINAL_VERSION="${BASE_VERSION}-dev"
98+
IS_PRERELEASE=true
99+
echo "🔧 Using dev version: $FINAL_VERSION"
100+
else
101+
FINAL_VERSION="${BASE_VERSION}-${STABILITY}"
102+
IS_PRERELEASE=true
103+
echo "🚧 Using $STABILITY version: $FINAL_VERSION"
104+
fi
105+
106+
echo "final-version=$FINAL_VERSION" >> $GITHUB_OUTPUT
107+
echo "is-prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
108+
echo "stability=$STABILITY" >> $GITHUB_OUTPUT
109+
110+
else
111+
echo "No composer.json found in ${{ matrix.package }}"
112+
echo "final-version=${{ needs.prepare.outputs.core-version }}" >> $GITHUB_OUTPUT
113+
echo "is-prerelease=false" >> $GITHUB_OUTPUT
114+
echo "stability=stable" >> $GITHUB_OUTPUT
115+
fi
116+
78117
- name: Replace core version in composer.json
79118
working-directory: packages/${{ matrix.package }}
80119
run: |
81120
if [ -f composer.json ]; then
82121
echo "Updating moox/core version in ${{ matrix.package }} to ${{ needs.prepare.outputs.core-version }}"
83-
sed -i 's/"moox\/core": "[^"]*"/"moox\/core": "${{ needs.prepare.outputs.core-version }}"/g' composer.json
122+
123+
# More robust sed pattern that handles different JSON formatting
124+
sed -i 's/"moox\/core":\s*"[^"]*"/"moox\/core": "${{ needs.prepare.outputs.core-version }}"/g' composer.json
125+
126+
# Also handle self.version case
127+
sed -i 's/"moox\/core":\s*"self\.version"/"moox\/core": "${{ needs.prepare.outputs.core-version }}"/g' composer.json
128+
84129
echo "Updated composer.json:"
85130
grep "moox/core" composer.json || echo "No moox/core dependency found"
86131
else
@@ -97,54 +142,68 @@ jobs:
97142
git commit -m "Update moox/core dependency to ${{ needs.prepare.outputs.core-version }}" || echo "No changes to commit"
98143
fi
99144
100-
- name: Split package to separate repository
101-
uses: symplify/[email protected]
102-
env:
103-
GITHUB_TOKEN: ${{ github.event.inputs.user_token != '' && github.event.inputs.user_token || secrets.BOT }}
104-
with:
105-
tag: "${{ github.event.inputs.version }}"
106-
package_directory: "packages/${{ matrix.package }}"
107-
repository_organization: "mooxphp"
108-
repository_name: "${{ matrix.package }}"
109-
user_name: "Moox Bot"
110-
user_email: "[email protected]"
111145
112-
- name: Create GitHub Release for split package
146+
- name: Split package to separate repository
113147
run: |
114148
PACKAGE="${{ matrix.package }}"
115-
VERSION="${{ github.event.inputs.version }}"
116-
RELEASE_BODY=$(echo '${{ github.event.inputs.packages }}' | jq -r ".\"$PACKAGE\".\"release-message\" // [] | .[:10] | join(\"\\n\")")
117-
STABILITY=$(echo '${{ github.event.inputs.packages }}' | jq -r ".\"$PACKAGE\".\"moox-stability\" // \"dev\"")
118-
149+
VERSION="${{ steps.version.outputs.final-version }}"
150+
IS_PRERELEASE="${{ steps.version.outputs.is-prerelease }}"
151+
STABILITY="${{ steps.version.outputs.stability }}"
152+
119153
echo "Package: $PACKAGE"
120-
echo "Version: $VERSION"
154+
echo "Version: $VERSION"
155+
echo "Is prerelease: $IS_PRERELEASE"
121156
echo "Stability: $STABILITY"
122-
echo "Release notes: $RELEASE_BODY"
157+
# - name: Split package to separate repository
158+
# uses: symplify/[email protected]
159+
# env:
160+
# GITHUB_TOKEN: ${{ github.event.inputs.user_token != '' && github.event.inputs.user_token || secrets.BOT }}
161+
# with:
162+
# tag: "${{ steps.version.outputs.final-version }}"
163+
# package_directory: "packages/${{ matrix.package }}"
164+
# repository_organization: "mooxphp"
165+
# repository_name: "${{ matrix.package }}"
166+
# user_name: "Moox Bot"
167+
# user_email: "[email protected]"
168+
169+
# - name: Create GitHub Release for split package
170+
# run: |
171+
# PACKAGE="${{ matrix.package }}"
172+
# VERSION="${{ steps.version.outputs.final-version }}"
173+
# IS_PRERELEASE="${{ steps.version.outputs.is-prerelease }}"
174+
# STABILITY="${{ steps.version.outputs.stability }}"
175+
# RELEASE_BODY=$(echo '${{ github.event.inputs.packages }}' | jq -r ".\"$PACKAGE\".\"release-message\" // [] | .[:10] | join(\"\\n\")")
123176

124-
# Only create release if stability is not 'dev'
125-
if [ "$STABILITY" != "dev" ]; then
126-
echo "✅ Creating release for $PACKAGE (stability: $STABILITY)"
177+
# echo "Package: $PACKAGE"
178+
# echo "Version: $VERSION"
179+
# echo "Stability: $STABILITY"
180+
# echo "Is prerelease: $IS_PRERELEASE"
181+
# echo "Release notes: $RELEASE_BODY"
182+
183+
# # Only create release if stability is not 'dev'
184+
# if [ "$STABILITY" != "dev" ]; then
185+
# echo "✅ Creating release for $PACKAGE (stability: $STABILITY)"
127186

128-
# Wait for tag propagation
129-
sleep 10
187+
# # Wait for tag propagation
188+
# sleep 10
130189

131-
if [ "${{ needs.prepare.outputs.is-prerelease }}" = "true" ]; then
132-
gh release create "$VERSION" \
133-
--repo "mooxphp/$PACKAGE" \
134-
--title "Release $VERSION" \
135-
--notes "$RELEASE_BODY" \
136-
--prerelease
137-
else
138-
gh release create "$VERSION" \
139-
--repo "mooxphp/$PACKAGE" \
140-
--title "Release $VERSION" \
141-
--notes "$RELEASE_BODY"
142-
fi
190+
# if [ "$IS_PRERELEASE" = "true" ]; then
191+
# gh release create "$VERSION" \
192+
# --repo "mooxphp/$PACKAGE" \
193+
# --title "Release $VERSION" \
194+
# --notes "$RELEASE_BODY" \
195+
# --prerelease
196+
# else
197+
# gh release create "$VERSION" \
198+
# --repo "mooxphp/$PACKAGE" \
199+
# --title "Release $VERSION" \
200+
# --notes "$RELEASE_BODY"
201+
# fi
143202

144-
echo "✅ Release created successfully"
145-
else
146-
echo "⏭️ Skipping release for $PACKAGE (stability: dev)"
147-
echo " Package was split to repository but no release was created"
148-
fi
149-
env:
150-
GH_TOKEN: ${{ github.event.inputs.user_token != '' && github.event.inputs.user_token || secrets.BOT }}
203+
# echo "✅ Release created successfully"
204+
# else
205+
# echo "⏭️ Skipping release for $PACKAGE (stability: dev)"
206+
# echo " Package was split to repository but no release was created"
207+
# fi
208+
# env:
209+
# GH_TOKEN: ${{ github.event.inputs.user_token != '' && github.event.inputs.user_token || secrets.BOT }}

packages/core/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"Moox\\Core\\CoreServiceProvider"
4040
]
4141
},
42+
"moox-stability": "stable",
4243
"moox": {
4344
"require": {
4445
"spatie/laravel-medialibrary": {

packages/devtools/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@
3838
},
3939
"minimum-stability": "dev",
4040
"prefer-stable": true,
41+
"extra": {
42+
"moox-stability": "dev"
43+
},
4144
"config": {
4245
"allow-plugins": {
4346
"pestphp/pest-plugin": true
4447
}
4548
}
46-
}
49+
}

packages/github/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"providers": [
3030
"Moox\\Github\\GithubServiceProvider"
3131
]
32-
}
32+
},
33+
"moox-stability": "stable"
3334
},
3435
"config": {
3536
"sort-packages": true

packages/monorepo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"composer-runtime-api": "^2.1",
1616
"symplify/monorepo-builder": "^11.0",
1717
"laravel/socialite": "^5.21",
18-
"moox/core": "*"
18+
"moox/core": "self.version"
1919
},
2020
"require-dev": {
2121
"moox/devlink": "*"

0 commit comments

Comments
 (0)