From 1cce1004ed9ea4dccf0df75cf0b3d2ad95ca4771 Mon Sep 17 00:00:00 2001 From: Houn Date: Tue, 3 Dec 2024 10:55:45 +0800 Subject: [PATCH] 2.1.23 --- particle-aa/CHANGELOG.md | 2 + particle-aa/example/pubspec.yaml | 6 +-- particle-aa/pubspec.yaml | 4 +- particle-auth-core/CHANGELOG.md | 2 + particle-auth-core/pubspec.yaml | 4 +- particle-base/CHANGELOG.md | 2 + particle-base/pubspec.yaml | 2 +- particle-connect/CHANGELOG.md | 2 + particle-connect/pubspec.yaml | 6 +-- particle-wallet/CHANGELOG.md | 2 + particle-wallet/pubspec.yaml | 8 ++-- pub.py | 63 ++++++++++++++++++++++---------- 12 files changed, 69 insertions(+), 34 deletions(-) diff --git a/particle-aa/CHANGELOG.md b/particle-aa/CHANGELOG.md index 7fd8444..fb2efac 100644 --- a/particle-aa/CHANGELOG.md +++ b/particle-aa/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.1.23 + ## 2.1.22 ## 2.1.21 diff --git a/particle-aa/example/pubspec.yaml b/particle-aa/example/pubspec.yaml index 9b68123..5fa367e 100644 --- a/particle-aa/example/pubspec.yaml +++ b/particle-aa/example/pubspec.yaml @@ -27,9 +27,9 @@ dependencies: # the parent directory to use the current plugin's version. path: ../ - particle_connect: ^2.1.22 - particle_base: ^2.1.22 - particle_auth_core: ^2.1.22 + particle_connect: ^2.1.23 + particle_base: ^2.1.23 + particle_auth_core: ^2.1.23 # particle_auth_core: ^2.0.0 # path: ../../particle-auth-core/ # particle_connect: ^2.0.0 diff --git a/particle-aa/pubspec.yaml b/particle-aa/pubspec.yaml index 79d575e..13140c0 100644 --- a/particle-aa/pubspec.yaml +++ b/particle-aa/pubspec.yaml @@ -1,6 +1,6 @@ name: particle_aa description: A flutter plugin project for particle aa -version: 2.1.22 +version: 2.1.23 homepage: https://particle.network environment: @@ -12,7 +12,7 @@ dependencies: sdk: flutter plugin_platform_interface: ^2.1.6 - particle_base: ^2.1.22 + particle_base: ^2.1.23 # particle_base: ^2.0.0 # path: ../particle-base/ diff --git a/particle-auth-core/CHANGELOG.md b/particle-auth-core/CHANGELOG.md index 7b320db..6be0270 100644 --- a/particle-auth-core/CHANGELOG.md +++ b/particle-auth-core/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.1.23 + ## 2.1.22 ## 2.1.21 diff --git a/particle-auth-core/pubspec.yaml b/particle-auth-core/pubspec.yaml index e7a9771..d69f98e 100644 --- a/particle-auth-core/pubspec.yaml +++ b/particle-auth-core/pubspec.yaml @@ -1,6 +1,6 @@ name: particle_auth_core description: A flutter plugin project for particle auth core -version: 2.1.22 +version: 2.1.23 homepage: https://particle.network environment: @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter plugin_platform_interface: ^2.1.6 - particle_base: ^2.1.22 + particle_base: ^2.1.23 # particle_base: ^2.0.0 # path: ../particle-base/ diff --git a/particle-base/CHANGELOG.md b/particle-base/CHANGELOG.md index e8b4659..1fd94c0 100644 --- a/particle-base/CHANGELOG.md +++ b/particle-base/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.1.23 + ## 2.1.22 ## 2.1.21 diff --git a/particle-base/pubspec.yaml b/particle-base/pubspec.yaml index d7a0a67..88906ea 100644 --- a/particle-base/pubspec.yaml +++ b/particle-base/pubspec.yaml @@ -1,6 +1,6 @@ name: particle_base description: A flutter plugin project for particle base -version: 2.1.22 +version: 2.1.23 homepage: https://particle.network environment: diff --git a/particle-connect/CHANGELOG.md b/particle-connect/CHANGELOG.md index d100704..1275928 100644 --- a/particle-connect/CHANGELOG.md +++ b/particle-connect/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.1.23 + ## 2.1.22 ## 2.1.21 diff --git a/particle-connect/pubspec.yaml b/particle-connect/pubspec.yaml index 214a194..1d65cae 100644 --- a/particle-connect/pubspec.yaml +++ b/particle-connect/pubspec.yaml @@ -1,6 +1,6 @@ name: particle_connect description: A flutter plugin project for particle connect -version: 2.1.22 +version: 2.1.23 homepage: https://particle.network/ environment: @@ -11,8 +11,8 @@ dependencies: flutter: sdk: flutter plugin_platform_interface: ^2.1.6 - particle_base: ^2.1.22 - particle_auth_core: ^2.1.22 + particle_base: ^2.1.23 + particle_auth_core: ^2.1.23 # particle_base: ^2.0.0 # path: ../particle-base/ # particle_auth_core: ^2.0.0 diff --git a/particle-wallet/CHANGELOG.md b/particle-wallet/CHANGELOG.md index e99952b..62a1245 100644 --- a/particle-wallet/CHANGELOG.md +++ b/particle-wallet/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.1.23 + ## 2.1.22 ## 2.1.21 diff --git a/particle-wallet/pubspec.yaml b/particle-wallet/pubspec.yaml index f95c258..ea8a2ff 100644 --- a/particle-wallet/pubspec.yaml +++ b/particle-wallet/pubspec.yaml @@ -1,6 +1,6 @@ name: particle_wallet description: A flutter plugin project for particle wallet -version: 2.1.22 +version: 2.1.23 homepage: https://particle.network environment: @@ -10,9 +10,9 @@ environment: dependencies: flutter: sdk: flutter - particle_connect: ^2.1.22 - particle_auth_core: ^2.1.22 - particle_base: ^2.1.22 + particle_connect: ^2.1.23 + particle_auth_core: ^2.1.23 + particle_base: ^2.1.23 plugin_platform_interface: ^2.1.6 diff --git a/pub.py b/pub.py index 75b4a51..1445f6f 100644 --- a/pub.py +++ b/pub.py @@ -1,14 +1,13 @@ import os +import requests import subprocess import time class ParticleBase: def update_pubspec_dependency(self, version): - # Read the original pubspec.yaml file content with open('pubspec.yaml', 'r') as file: lines = file.readlines() - # Find the particle_auth dependency and update the version number updated_lines = [] for line in lines: if line.strip().startswith('#'): @@ -22,7 +21,6 @@ def update_pubspec_dependency(self, version): else: updated_lines.append(line) - # Write the updated content back to the file with open('pubspec.yaml', 'w') as file: file.writelines(updated_lines) @@ -35,7 +33,6 @@ def replace_version(self): with open(self.pubspec_path, 'r') as file: lines = file.readlines() - # Modify the third line lines[2] = f'version: {self.version}\n' with open(self.pubspec_path, 'w') as file: @@ -45,9 +42,7 @@ def add_to_changelog(self): with open(self.changelog_path, 'r') as file: lines = file.readlines() - # Check if the first line contains the new version number if f'## {self.version}\n' not in lines: - # Add new version information to the first line lines.insert(0, f'## {self.version}\n\n') with open(self.changelog_path, 'w') as file: @@ -82,11 +77,6 @@ def publish(self): self.flutter_publish() self.close() - def publish_dry_run(self): - self.prepare() - self.flutter_publish_dry_run() - self.close() - class ParticleConnect(ParticleBase): def __init__(self, version): @@ -134,7 +124,6 @@ def self_prepare(self): def publish(self): self.prepare() self.self_prepare() - self.flutter_get() self.flutter_publish() self.close() @@ -151,32 +140,68 @@ def self_prepare(self): def publish(self): self.prepare() self.self_prepare() - self.flutter_get() self.flutter_publish() self.close() +def is_package_published(package_name, version): + """ + Check if a package version is published on pub.dev. + """ + try: + url = f"https://pub.dev/api/packages/{package_name}" + response = requests.get(url) + response.raise_for_status() + + package_data = response.json() + latest = package_data.get('latest', {}) + latest_version = latest.get('version') + print('latest_version:',latest_version) + if latest_version == version: + print(f"✅ {package_name} version {version} is published!") + return True + else: + print(f"❌ {package_name} version {version} is not published yet.") + return False + except requests.RequestException as e: + print(f"Error checking package publication: {e}") + return False + + +def wait_until_published(package_name, version): + """ + Wait until the package version is published. + """ + while not is_package_published(package_name, version): + print(f"Waiting for {package_name} version {version} to be published...") + time.sleep(10) # Wait 10 seconds before checking again + + if __name__ == "__main__": - version = '2.1.22' - sleep_time = 60 + version = '2.1.23' + print("Base Start") ParticleAuth(version).publish() + wait_until_published("particle_base", version) print("Base Finish") - time.sleep(sleep_time) + print("AuthCore Start") ParticleAuthCore(version).publish() + wait_until_published("particle_auth_core", version) print("AuthCore Finish") - time.sleep(sleep_time) + print("Connect Start") ParticleConnect(version).publish() + wait_until_published("particle_connect", version) print("Connect Finish") - time.sleep(sleep_time) print("ParticleAA Start") ParticleAA(version).publish() + wait_until_published("particle_aa", version) print("ParticleAA Finish") - time.sleep(sleep_time) + print("ParticleWallet Start") ParticleWallet(version).publish() + wait_until_published("particle_wallet", version) print("ParticleWallet Finish")