99 packages :
1010 description : " Packages to deploy (JSON object with package info)"
1111 required : true
12+ user_name :
13+ description : " User name for commits and releases"
14+ required : false
15+ default : " "
16+ user_email :
17+ description : " User email for commits and releases"
18+ required : false
19+ default : " "
20+ user_token :
21+ description : " User's GitHub token (for release authorship)"
22+ required : false
23+ default : " "
1224
1325env :
1426 GITHUB_TOKEN : ${{ secrets.BOT }}
7385 run : |
7486 if [ -f composer.json ]; then
7587 echo "Updating moox/core version in ${{ matrix.package }} to ${{ needs.prepare.outputs.core-version }}"
76- sed -i 's/"moox\/core": "\*"/"moox\/core": "${{ needs.prepare.outputs.core-version }}"/g' composer.json
88+ # Replace any existing moox/core version with the current version
89+ sed -i 's/"moox\/core": "[^"]*"/"moox\/core": "${{ needs.prepare.outputs.core-version }}"/g' composer.json
7790
7891 echo "Updated composer.json:"
7992 cat composer.json | grep "moox/core" || echo "No moox/core dependency found"
@@ -85,18 +98,50 @@ jobs:
8598 working-directory : packages/${{ matrix.package }}
8699 run : |
87100 if [ -f composer.json ]; then
88- git config --global user.name "mooxbot"
89- git config --global user.email "[email protected] " 101+ USER_NAME="${{ github.event.inputs.user_name || github.actor }}"
102+ USER_EMAIL="${{ github.event.inputs.user_email || format('{0}@users.noreply.github.com', github.actor) }}"
103+ git config --global user.name "$USER_NAME"
104+ git config --global user.email "$USER_EMAIL"
90105 git add composer.json
91106 git commit -m "Update moox/core dependency to ${{ needs.prepare.outputs.core-version }}" || echo "No changes to commit"
92107 fi
93108
94109 - name : Split package to separate repository
95110 uses :
" symplify/[email protected] " 96111 with :
97- tag : " v ${{ github.event.inputs.version }}"
112+ tag : " ${{ github.event.inputs.version }}"
98113 package_directory : " packages/${{ matrix.package }}"
99114 repository_organization : " mooxphp"
100115 repository_name : " ${{ matrix.package }}"
101- user_name : " mooxbot"
102- 116+ user_name : " ${{ github.event.inputs.user_name || github.actor }}"
117+ user_email : " ${{ github.event.inputs.user_email || format('{0}@users.noreply.github.com', github.actor) }}"
118+
119+ - name : Create GitHub Release for split package
120+ run : |
121+ PACKAGE="${{ matrix.package }}"
122+ VERSION="${{ github.event.inputs.version }}"
123+ RELEASE_BODY=$(echo '${{ github.event.inputs.packages }}' | jq -r ".\"$PACKAGE\".\"release-message\"[]" | head -10 | tr '\n' ' ')
124+ IS_PRERELEASE=${{ contains(github.event.inputs.version, 'alpha') || contains(github.event.inputs.version, 'beta') || contains(github.event.inputs.version, 'rc') }}
125+ USER_NAME="${{ github.event.inputs.user_name || github.actor }}"
126+
127+ # Use user token if provided, otherwise use bot token
128+ if [ -n "${{ github.event.inputs.user_token }}" ]; then
129+ RELEASE_TOKEN="${{ github.event.inputs.user_token }}"
130+ echo "Creating release as user: $USER_NAME"
131+ else
132+ RELEASE_TOKEN="${{ secrets.TOKEN }}"
133+ echo "Creating release as bot (no user token provided)"
134+ RELEASE_BODY="$RELEASE_BODY - Released by: $USER_NAME"
135+ fi
136+
137+ # Wait a moment for tag to be available
138+ sleep 10
139+
140+ # Create release from existing tag using GitHub CLI
141+ gh release create "$VERSION" \
142+ --repo "mooxphp/$PACKAGE" \
143+ --title "Release $VERSION" \
144+ --notes "$RELEASE_BODY" \
145+ $([ "$IS_PRERELEASE" = "true" ] && echo "--prerelease" || echo "")
146+ env :
147+ GH_TOKEN : ${{ github.event.inputs.user_token || secrets.TOKEN }}
0 commit comments