Skip to content

Commit b4b6f1a

Browse files
committed
ci: Build test
1 parent d6a1691 commit b4b6f1a

File tree

2 files changed

+57
-35
lines changed

2 files changed

+57
-35
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ jobs:
184184
asset_name: apisnip-netbsd-x86_64
185185
use_cross: true
186186

187-
- name: OpenBSD x86_64
188-
os: ubuntu-latest
189-
target: x86_64-unknown-openbsd
190-
asset_name: apisnip-openbsd-x86_64
191-
use_cross: true
187+
# - name: OpenBSD x86_64
188+
# os: ubuntu-latest
189+
# target: x86_64-unknown-openbsd
190+
# asset_name: apisnip-openbsd-x86_64
191+
# use_cross: true
192192

193193
# Additional exotic targets
194194
- name: WASM (WebAssembly)
@@ -197,11 +197,11 @@ jobs:
197197
asset_name: apisnip-wasm
198198
use_cross: false
199199

200-
- name: WASI (WebAssembly System Interface)
201-
os: ubuntu-latest
202-
target: wasm32-wasi
203-
asset_name: apisnip-wasi
204-
use_cross: false
200+
# - name: WASI (WebAssembly System Interface)
201+
# os: ubuntu-latest
202+
# target: wasm32-wasi
203+
# asset_name: apisnip-wasi
204+
# use_cross: false
205205

206206
- name: PowerPC 64-bit LE
207207
os: ubuntu-latest
@@ -215,11 +215,11 @@ jobs:
215215
asset_name: apisnip-linux-s390x
216216
use_cross: true
217217

218-
- name: MIPS 64-bit
219-
os: ubuntu-latest
220-
target: mips64-unknown-linux-gnuabi64
221-
asset_name: apisnip-linux-mips64
222-
use_cross: true
218+
# - name: MIPS 64-bit
219+
# os: ubuntu-latest
220+
# target: mips64-unknown-linux-gnuabi64
221+
# asset_name: apisnip-linux-mips64
222+
# use_cross: true
223223

224224
steps:
225225
# Checkout the repository
@@ -411,6 +411,11 @@ jobs:
411411
env:
412412
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
413413

414+
# Restore Cargo.lock from git if changed
415+
- name: Restore Cargo.lock from git if changed
416+
run: git checkout -- Cargo.lock
417+
if: always()
418+
414419
# Job to summarize all builds
415420
build-summary:
416421
name: Build Summary

scripts/bump-version.sh

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -338,33 +338,50 @@ if ! $DRY_RUN; then
338338
if [[ "$AUTO_EXECUTE" =~ ^[Yy]$ ]]; then
339339
step "Executing Steps 🚀"
340340

341-
execute "git commit -am \"Bump version to $NEW_VERSION\"" \
342-
"Committing changes..." \
343-
"Failed to commit changes. Please check your git status."
341+
# Check if there are changes to commit
342+
info "Checking git status..."
343+
if ! git diff --quiet HEAD -- "$CARGO_TOML" "Cargo.lock"; then
344+
# There are changes to commit
345+
execute "git add $CARGO_TOML Cargo.lock" \
346+
"Staging changes..." \
347+
"Failed to stage changes."
348+
349+
if [ $? -eq 0 ]; then
350+
execute "git commit -m \"Bump version to $NEW_VERSION\"" \
351+
"Committing changes..." \
352+
"Failed to commit changes. Please check your git status."
353+
fi
354+
else
355+
warning "No changes detected in Cargo.toml or Cargo.lock. They might already be at version $NEW_VERSION."
356+
info "Proceeding with tag creation anyway..."
357+
fi
344358

345-
# Only proceed with tagging if commit was successful
346-
if [ $? -eq 0 ]; then
359+
# Always try to create the tag, even if commit failed (might be using existing commit)
360+
# Check if tag already exists
361+
if git rev-parse "v$NEW_VERSION" >/dev/null 2>&1; then
362+
warning "Tag v$NEW_VERSION already exists! Skipping tag creation."
363+
else
347364
execute "git tag -a \"v$NEW_VERSION\" -m \"Release v$NEW_VERSION\"" \
348365
"Creating tag v$NEW_VERSION..." \
349366
"Failed to create tag. Perhaps it already exists?"
367+
fi
368+
369+
# Only proceed with push if we have something to push (commit or tag)
370+
if [ $? -eq 0 ]; then
371+
# Confirm before pushing (this is a potentially risky operation)
372+
printf "${YELLOW}Ready to push changes and tags to remote. Continue?${RESET} [y/N] "
373+
read -r CONFIRM_PUSH
350374

351-
# Only proceed with push if tagging was successful
352-
if [ $? -eq 0 ]; then
353-
# Confirm before pushing (this is a potentially risky operation)
354-
printf "${YELLOW}Ready to push changes and tags to remote. Continue?${RESET} [y/N] "
355-
read -r CONFIRM_PUSH
375+
if [[ "$CONFIRM_PUSH" =~ ^[Yy]$ ]]; then
376+
execute "git push && git push --tags" \
377+
"Pushing changes and tags..." \
378+
"Failed to push. Do you have upstream permissions?"
356379

357-
if [[ "$CONFIRM_PUSH" =~ ^[Yy]$ ]]; then
358-
execute "git push && git push --tags" \
359-
"Pushing changes and tags..." \
360-
"Failed to push. Do you have upstream permissions?"
361-
362-
if [ $? -eq 0 ]; then
363-
success "All steps completed successfully! 🎉"
364-
fi
365-
else
366-
info "Skipping push operation. Changes are committed locally."
380+
if [ $? -eq 0 ]; then
381+
success "All steps completed successfully! 🎉"
367382
fi
383+
else
384+
info "Skipping push operation. Changes are committed locally."
368385
fi
369386
fi
370387
else

0 commit comments

Comments
 (0)