From 2242ad1847804c563232af8ce51903b457da187b Mon Sep 17 00:00:00 2001 From: Saber Haj Rabiee Date: Fri, 7 Mar 2025 05:21:21 -0800 Subject: [PATCH] fix: semver and feature handy script for update nightly (#3674) --- .github/workflows/ci-semver.yml | 4 +-- .github/workflows/ci.yml | 2 +- examples/spread/rust-toolchain.toml | 2 +- leptos_macro/Makefile.toml | 4 +-- scripts/update_nightly.sh | 45 +++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 6 deletions(-) create mode 100755 scripts/update_nightly.sh diff --git a/.github/workflows/ci-semver.yml b/.github/workflows/ci-semver.yml index e577c414e..16ee242a2 100644 --- a/.github/workflows/ci-semver.yml +++ b/.github/workflows/ci-semver.yml @@ -18,7 +18,7 @@ jobs: test: needs: [get-leptos-changed] if: needs.get-leptos-changed.outputs.leptos_changed == 'true' && github.event.pull_request.labels[0].name != 'breaking' - name: Run semver check (nightly-2025-02-19) + name: Run semver check (nightly-2025-03-05) runs-on: ubuntu-latest steps: - name: Install Glib @@ -30,4 +30,4 @@ jobs: - name: Semver Checks uses: obi1kenobi/cargo-semver-checks-action@v2 with: - rust-toolchain: nightly-2025-02-19 + rust-toolchain: nightly-2025-03-05 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 967483ded..f4685bdb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,4 +26,4 @@ jobs: with: directory: ${{ matrix.directory }} cargo_make_task: "ci" - toolchain: nightly-2025-02-19 + toolchain: nightly-2025-03-05 diff --git a/examples/spread/rust-toolchain.toml b/examples/spread/rust-toolchain.toml index 055e912d2..193b5ac5d 100644 --- a/examples/spread/rust-toolchain.toml +++ b/examples/spread/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2024-01-29" +channel = "nightly-2025-03-05" diff --git a/leptos_macro/Makefile.toml b/leptos_macro/Makefile.toml index a2d155034..d98a377d3 100644 --- a/leptos_macro/Makefile.toml +++ b/leptos_macro/Makefile.toml @@ -11,13 +11,13 @@ dependencies = [ [tasks.test-leptos_macro-example] description = "Tests the leptos_macro/example to check if macro handles doc comments correctly" command = "cargo" -args = ["+nightly-2025-02-19", "test", "--doc"] +args = ["+nightly-2025-03-05", "test", "--doc"] cwd = "example" install_crate = false [tasks.doc-leptos_macro-example] description = "Docs the leptos_macro/example to check if macro handles doc comments correctly" command = "cargo" -args = ["+nightly-2025-02-19", "doc"] +args = ["+nightly-2025-03-05", "doc"] cwd = "example" install_crate = false diff --git a/scripts/update_nightly.sh b/scripts/update_nightly.sh new file mode 100755 index 000000000..62f28f4af --- /dev/null +++ b/scripts/update_nightly.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +set -e + +exit_error() { + echo "ERROR: $1" >&2 + exit 1 +} + +current_dir=$(pwd) + +if [[ "$current_dir" != */leptos ]]; then + exit_error "Current directory does not end with leptos" +fi + +# Check if a date is provided as an argument +if [ $# -eq 1 ]; then + NEW_DATE=$1 + echo -n "Will use the provided date: " +else + # Use current date if no date is provided + NEW_DATE=$(date +"%Y-%m-%d") + echo -n "Will use the current date: " +fi + +echo "$NEW_DATE" + +# Detect if it is darwin sed +if sed --version 2>/dev/null | grep -q GNU; then + SED_COMMAND="sed -i" +else + SED_COMMAND='sed -i ""' +fi + +MATCH="nightly-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" +REPLACE="nightly-$NEW_DATE" + +# Find all occurrences of the pattern +git grep -l "$MATCH" | while read -r file; do + # Replace the pattern in each file + $SED_COMMAND "s/$MATCH/$REPLACE/g" "$file" + echo "Updated $file" +done + +echo "All occurrences of 'nightly-XXXX-XX-XX' have been replaced with 'nightly-$NEW_DATE'"