|
5 | 5 |
|
6 | 6 | set -e |
7 | 7 |
|
| 8 | +# Check if running in CI environment or --ci flag is passed |
| 9 | +CI_MODE=false |
| 10 | +if [[ "$CI" == "true" ]] || [[ "$GITHUB_ACTIONS" == "true" ]] || [[ "$1" == "--ci" ]]; then |
| 11 | + CI_MODE=true |
| 12 | +fi |
| 13 | + |
8 | 14 | # Load shared utilities |
9 | 15 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
10 | 16 | source "$SCRIPT_DIR/../utils/version-utils.sh" |
@@ -117,10 +123,14 @@ if [ -d ".git" ]; then |
117 | 123 | warning "There are uncommitted changes:" |
118 | 124 | git status --porcelain |
119 | 125 | echo "" |
120 | | - read -p "Continue anyway? (y/N) " -n 1 -r |
121 | | - echo |
122 | | - if [[ ! $REPLY =~ ^[Yy]$ ]]; then |
123 | | - error "Cancelled by user" |
| 126 | + if [[ "$CI_MODE" == "true" ]]; then |
| 127 | + warning "CI Mode: Continuing with uncommitted changes" |
| 128 | + else |
| 129 | + read -p "Continue anyway? (y/N) " -n 1 -r |
| 130 | + echo |
| 131 | + if [[ ! $REPLY =~ ^[Yy]$ ]]; then |
| 132 | + error "Cancelled by user" |
| 133 | + fi |
124 | 134 | fi |
125 | 135 | else |
126 | 136 | info "All files are committed" |
@@ -201,22 +211,26 @@ echo " - Packagist: https://packagist.org" |
201 | 211 | echo " - Documentation: https://pivotphp.com" |
202 | 212 | echo "" |
203 | 213 |
|
204 | | -# 12. Offer to execute useful commands |
205 | | -read -p "Do you want to execute 'composer validate' now? (y/N) " -n 1 -r |
206 | | -echo |
207 | | -if [[ $REPLY =~ ^[Yy]$ ]]; then |
208 | | - composer validate |
209 | | -fi |
| 214 | +# 12. Offer to execute useful commands (only in interactive mode) |
| 215 | +if [[ "$CI_MODE" == "false" ]]; then |
| 216 | + read -p "Do you want to execute 'composer validate' now? (y/N) " -n 1 -r |
| 217 | + echo |
| 218 | + if [[ $REPLY =~ ^[Yy]$ ]]; then |
| 219 | + composer validate |
| 220 | + fi |
210 | 221 |
|
211 | | -read -p "Do you want to see a preview of what will be included in the package? (y/N) " -n 1 -r |
212 | | -echo |
213 | | -if [[ $REPLY =~ ^[Yy]$ ]]; then |
214 | | - echo "Files that will be included in the package:" |
215 | | - if [ -d ".git" ]; then |
216 | | - git ls-files 2>/dev/null || find . -type f -not -path "./vendor/*" -not -path "./.git/*" -not -path "./node_modules/*" |
217 | | - else |
218 | | - find . -type f -not -path "./vendor/*" -not -path "./.git/*" -not -path "./node_modules/*" |
| 222 | + read -p "Do you want to see a preview of what will be included in the package? (y/N) " -n 1 -r |
| 223 | + echo |
| 224 | + if [[ $REPLY =~ ^[Yy]$ ]]; then |
| 225 | + echo "Files that will be included in the package:" |
| 226 | + if [ -d ".git" ]; then |
| 227 | + git ls-files 2>/dev/null || find . -type f -not -path "./vendor/*" -not -path "./.git/*" -not -path "./node_modules/*" |
| 228 | + else |
| 229 | + find . -type f -not -path "./vendor/*" -not -path "./.git/*" -not -path "./node_modules/*" |
| 230 | + fi |
219 | 231 | fi |
| 232 | +else |
| 233 | + info "CI Mode: Skipping interactive commands" |
220 | 234 | fi |
221 | 235 |
|
222 | 236 | echo "" |
|
0 commit comments