Skip to content

Commit

Permalink
version check before pub upload for CI. (#372)
Browse files Browse the repository at this point in the history
* version check before pub upload for CI.

* update.

* update.

* Update publish.yaml

* Update publish.yaml

* Update publish.yaml

* Update build.yaml

* Correct the version, CI should pass.

* release: 1.5.2.
  • Loading branch information
cloudwebrtc authored Sep 29, 2023
1 parent 8f16ced commit 5fa0cf6
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: dart format lib/ test/ --set-exit-if-changed
- name: Import Sorter Check
run: dart run import_sorter:main --no-comments --exit-if-changed
- name: Check version consistency
run: dart run scripts/check_version.dart
- name: Dart Analyze Check
run: flutter analyze
- name: Dart Test Check
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.0'
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Dart Format Check
Expand All @@ -37,9 +37,17 @@ jobs:
run: flutter analyze
- name: Dart Test Check
run: flutter test
- name: Check version consistency
run: dart run scripts/check_version.dart
#- name: Check Publish Warnings
# run: dart pub publish --dry-run

- name: Publish
uses: k-paxian/[email protected]
with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: true
skipTests: true
force: true
- run: flutter pub global activate dartdoc

# Generate docs
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 1.5.2

* Non-functional update, forcing the versions in
`'ios/livekit_client.podspec', 'macos/livekit_client.podspec', 'lib/src/livekit.dart'`
consistent with pubspec.yaml

## 1.5.1

* Fixed Renderer bug for Windows.
Expand Down
2 changes: 1 addition & 1 deletion ios/livekit_client.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'livekit_client'
s.version = '1.5.1'
s.version = '1.5.2'
s.summary = 'Open source platform for real-time audio and video.'
s.description = 'Open source platform for real-time audio and video.'
s.homepage = 'https://livekit.io/'
Expand Down
2 changes: 1 addition & 1 deletion lib/src/livekit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'types/other.dart';
/// Main entry point to connect to a room.
/// {@category Room}
class LiveKitClient {
static const version = '1.4.2';
static const version = '1.5.2';

/// Convenience method for connecting to a LiveKit server.
/// Returns a [Room] upon a successful connect or throws when it fails.
Expand Down
2 changes: 1 addition & 1 deletion macos/livekit_client.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'livekit_client'
s.version = '1.5.1'
s.version = '1.5.2'
s.summary = 'Open source platform for real-time audio and video.'
s.description = 'Open source platform for real-time audio and video.'
s.homepage = 'https://livekit.io/'
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
name: livekit_client
description: Flutter Client SDK for LiveKit.
Build real-time video and audio into your apps. Supports iOS, Android, and Web.
version: 1.5.1
version: 1.5.2
homepage: https://livekit.io

environment:
Expand Down Expand Up @@ -52,6 +52,7 @@ dev_dependencies:
flutter_lints: ^2.0.1
mockito: ^5.3.2
import_sorter: ^4.6.0
yaml: ^3.1.2

import_sorter:
comments: false
Expand Down
27 changes: 27 additions & 0 deletions scripts/check_version.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'dart:io';

import 'package:yaml/yaml.dart';

void main() {
File pubspec = File('pubspec.yaml');
var doc = loadYaml(pubspec.readAsStringSync());
var version = doc['version'];

var files = [
'ios/livekit_client.podspec',
'macos/livekit_client.podspec',
'lib/src/livekit.dart'
];

for (var file in files) {
var content = File(file).readAsStringSync();
if (!content.contains(version)) {
RegExp exp = RegExp(r'(\d+\.\d+\.\d+)');
RegExpMatch? match = exp.firstMatch(content);
// ignore: avoid_print
print(
'Version mismatch in $file, pubspec.yaml version is $version != ${match![0]} in $file, please update');
exit(1);
}
}
}

0 comments on commit 5fa0cf6

Please sign in to comment.