From eb9df2ac8576b7cf57e2ed02dd42f509f1496c76 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 14:23:31 -0800 Subject: [PATCH 01/11] prevent release without rc --- .github/workflows/python-release.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 7541360bf2..681259897b 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -37,6 +37,18 @@ jobs: os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ] steps: + - name: Validate version input + run: | + version="${{ github.event.inputs.version }}" + if [[ "$version" == "main" ]]; then + echo "Valid version: main" + elif [[ "$version" == rc* ]] && [[ "${version:2}" =~ ^[0-9]+$ ]]; then + echo "Valid version: $version" + else + echo "Error: Version must be 'main' or 'rc' followed by a number (e.g., rc1, rc2, etc.)" + exit 1 + fi + - uses: actions/checkout@v4 with: fetch-depth: 0 From 73fc8317d540e7d5863d4016f98b2eb395950824 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 14:30:28 -0800 Subject: [PATCH 02/11] modify --- .github/workflows/python-release.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 681259897b..ea8c2356eb 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -40,12 +40,21 @@ jobs: - name: Validate version input run: | version="${{ github.event.inputs.version }}" + # Trim whitespace + version="${version// /}" + + if [[ -z "$version" ]]; then + echo "Error: Version input cannot be empty" + exit 1 + fi + if [[ "$version" == "main" ]]; then - echo "Valid version: main" - elif [[ "$version" == rc* ]] && [[ "${version:2}" =~ ^[0-9]+$ ]]; then - echo "Valid version: $version" + echo "✓ Valid version: main" + elif [[ "$version" =~ ^rc[0-9]+$ ]]; then + echo "✓ Valid version: $version" else - echo "Error: Version must be 'main' or 'rc' followed by a number (e.g., rc1, rc2, etc.)" + echo "❌ Error: Version must be 'main' or 'rc' followed by a number (e.g., rc1, rc2)" + echo " Received: '$version'" exit 1 fi From e885d00c023bf713d0ece273c87343638e9a3281 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 14:50:00 -0800 Subject: [PATCH 03/11] fixg --- .github/workflows/python-release.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index ea8c2356eb..64f4ead982 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -42,22 +42,14 @@ jobs: version="${{ github.event.inputs.version }}" # Trim whitespace version="${version// /}" - - if [[ -z "$version" ]]; then - echo "Error: Version input cannot be empty" - exit 1 - fi - - if [[ "$version" == "main" ]]; then - echo "✓ Valid version: main" - elif [[ "$version" =~ ^rc[0-9]+$ ]]; then - echo "✓ Valid version: $version" + echo "Checking if version is 'main' or a valid rc candidate" + # Matches "main" or any string ending with "rc" followed by one or more digits. + if echo "$version" | grep -E -q '^(main|.*rc[0-9]+)$'; then + echo "Valid version: $version" else - echo "❌ Error: Version must be 'main' or 'rc' followed by a number (e.g., rc1, rc2)" - echo " Received: '$version'" + echo "Invalid version: $version" >&2 exit 1 fi - - uses: actions/checkout@v4 with: fetch-depth: 0 From 0a1f24e54e13b9bc3c65040bf78522374c0a40c8 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 14:59:32 -0800 Subject: [PATCH 04/11] use github action eval --- .github/workflows/python-release.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 64f4ead982..f0a452ba4f 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -37,19 +37,15 @@ jobs: os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ] steps: - - name: Validate version input - run: | - version="${{ github.event.inputs.version }}" - # Trim whitespace - version="${version// /}" - echo "Checking if version is 'main' or a valid rc candidate" - # Matches "main" or any string ending with "rc" followed by one or more digits. - if echo "$version" | grep -E -q '^(main|.*rc[0-9]+)$'; then - echo "Valid version: $version" - else - echo "Invalid version: $version" >&2 - exit 1 - fi + - name: Validate version input + if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} + run: | + echo "Error: Invalid version format. You provided: '${{ github.event.inputs.version }}'" + echo "Allowed formats:" + echo " - 'main'" + echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" + exit 1 + - uses: actions/checkout@v4 with: fetch-depth: 0 From 4c23d977f501435d6fe8a3df7055ed99a604a6dc Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 15:00:40 -0800 Subject: [PATCH 05/11] spacing --- .github/workflows/python-release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index f0a452ba4f..d82753f34c 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -37,14 +37,14 @@ jobs: os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ] steps: - - name: Validate version input - if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} - run: | - echo "Error: Invalid version format. You provided: '${{ github.event.inputs.version }}'" - echo "Allowed formats:" - echo " - 'main'" - echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" - exit 1 + - name: Validate version input + if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} + run: | + echo "Error: Invalid version format. You provided: '${{ github.event.inputs.version }}'" + echo "Allowed formats:" + echo " - 'main'" + echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" + exit 1 - uses: actions/checkout@v4 with: From 7ca5103132d2c968e44902ef9df1c0f677c1901f Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 15:02:29 -0800 Subject: [PATCH 06/11] new job --- .github/workflows/python-release.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index d82753f34c..f3380333c3 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -29,23 +29,27 @@ on: jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ] - + validate_version: + name: Validate version input + runs-on: ubuntu-latest steps: - - name: Validate version input + - name: Check version format if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} run: | echo "Error: Invalid version format. You provided: '${{ github.event.inputs.version }}'" echo "Allowed formats:" echo " - 'main'" - echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" + echo " - Semantic version with 'rc' suffix (e.g., 0.8.0rc1, 0.8.0rc2)" exit 1 + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ] + + steps: - uses: actions/checkout@v4 with: fetch-depth: 0 From 465d962dd9c6c538ebddf889cb02b97063b0078f Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 15:03:14 -0800 Subject: [PATCH 07/11] wording --- .github/workflows/python-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index f3380333c3..1241ef9584 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -33,13 +33,13 @@ jobs: name: Validate version input runs-on: ubuntu-latest steps: - - name: Check version format + - name: Validate version input if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} run: | echo "Error: Invalid version format. You provided: '${{ github.event.inputs.version }}'" echo "Allowed formats:" echo " - 'main'" - echo " - Semantic version with 'rc' suffix (e.g., 0.8.0rc1, 0.8.0rc2)" + echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" exit 1 build_wheels: From f722924752b9bc0ebdfaf92b00e859c4b2c6f9d1 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 15:05:42 -0800 Subject: [PATCH 08/11] depend --- .github/workflows/python-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 1241ef9584..1a4b9b8347 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -48,6 +48,7 @@ jobs: strategy: matrix: os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ] + needs: validate_version steps: - uses: actions/checkout@v4 From f34dd264cd5418ea023b089502941d177db60e44 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 16:31:01 -0800 Subject: [PATCH 09/11] echo --- .github/workflows/python-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 1a4b9b8347..cc1bd48a5e 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -33,6 +33,9 @@ jobs: name: Validate version input runs-on: ubuntu-latest steps: + - name: Echo version input + run: echo "Version input: '${{ github.event.inputs.version }}'" + - name: Validate version input if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} run: | From 9230d3e483473c12ec8e6c4a80e0e6e4f2dfa2d2 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 16:34:11 -0800 Subject: [PATCH 10/11] format --- .github/workflows/python-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index cc1bd48a5e..bcd75030e6 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -34,15 +34,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Echo version input - run: echo "Version input: '${{ github.event.inputs.version }}'" + run: echo "Version input is: ${{ github.event.inputs.version }}" - name: Validate version input if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }} run: | echo "Error: Invalid version format. You provided: '${{ github.event.inputs.version }}'" echo "Allowed formats:" - echo " - 'main'" - echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" + echo " - 'main'" + echo " - version string containing 'rc' (e.g., 0.8.0rc1, 0.8.0rc2)" exit 1 build_wheels: From 8d85b99b96500d41c2052ec95bf7ededeff5731a Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 27 Nov 2024 16:34:49 -0800 Subject: [PATCH 11/11] format --- .github/workflows/python-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index bcd75030e6..5b0627f075 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -34,7 +34,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Echo version input - run: echo "Version input is: ${{ github.event.inputs.version }}" + run: | + echo "Version input is: ${{ github.event.inputs.version }}" - name: Validate version input if: ${{ github.event.inputs.version != 'main' && !contains(github.event.inputs.version, 'rc') }}