Skip to content

Commit

Permalink
2.1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
Houn committed Dec 3, 2024
1 parent b542fcc commit 1cce100
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 34 deletions.
2 changes: 2 additions & 0 deletions particle-aa/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.1.23

## 2.1.22

## 2.1.21
Expand Down
6 changes: 3 additions & 3 deletions particle-aa/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions particle-aa/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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/
Expand Down
2 changes: 2 additions & 0 deletions particle-auth-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.1.23

## 2.1.22

## 2.1.21
Expand Down
4 changes: 2 additions & 2 deletions particle-auth-core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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/

Expand Down
2 changes: 2 additions & 0 deletions particle-base/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.1.23

## 2.1.22

## 2.1.21
Expand Down
2 changes: 1 addition & 1 deletion particle-base/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 2 additions & 0 deletions particle-connect/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.1.23

## 2.1.22

## 2.1.21
Expand Down
6 changes: 3 additions & 3 deletions particle-connect/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions particle-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.1.23

## 2.1.22

## 2.1.21
Expand Down
8 changes: 4 additions & 4 deletions particle-wallet/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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

Expand Down
63 changes: 44 additions & 19 deletions pub.py
Original file line number Diff line number Diff line change
@@ -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('#'):
Expand All @@ -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)

Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -134,7 +124,6 @@ def self_prepare(self):
def publish(self):
self.prepare()
self.self_prepare()

self.flutter_get()
self.flutter_publish()
self.close()
Expand All @@ -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")

0 comments on commit 1cce100

Please sign in to comment.