mirror of
https://github.com/xvrh/lottie-flutter.git
synced 2025-08-06 16:39:36 +08:00
Revert Setup github publishing
It doesn't work for flutter packages
This commit is contained in:
30
.github/workflows/publish-on-pub.yaml
vendored
30
.github/workflows/publish-on-pub.yaml
vendored
@ -1,10 +1,28 @@
|
||||
name: Publish to pub.dev
|
||||
|
||||
name: Publish package to pub.dev
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+*'
|
||||
|
||||
- v*
|
||||
jobs:
|
||||
publish:
|
||||
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: 'stable'
|
||||
- run: flutter pub get
|
||||
- run: flutter pub run tool/publish/check_version.dart ${GITHUB_REF}
|
||||
- name: Setup credentials
|
||||
run: |
|
||||
cat <<EOF > $PUB_CACHE/credentials.json
|
||||
{
|
||||
"accessToken":"${{ secrets.OAUTH_ACCESS_TOKEN }}",
|
||||
"refreshToken":"${{ secrets.OAUTH_REFRESH_TOKEN }}",
|
||||
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
|
||||
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
|
||||
"expiration": 1580681402856
|
||||
}
|
||||
EOF
|
||||
- name: Publish package
|
||||
run: flutter pub publish --force
|
||||
|
24
tool/publish/check_version.dart
Normal file
24
tool/publish/check_version.dart
Normal file
@ -0,0 +1,24 @@
|
||||
import 'dart:io';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
void main(List<String> args) {
|
||||
print(args);
|
||||
var pubspec = File('pubspec.yaml');
|
||||
var content = loadYaml(pubspec.readAsStringSync()) as YamlMap;
|
||||
|
||||
var pubspecVersion = content['version'] as String;
|
||||
var tagVersion = '';
|
||||
if (args.isNotEmpty) {
|
||||
tagVersion = args[0].split('/').last;
|
||||
}
|
||||
if (tagVersion.startsWith('v')) {
|
||||
tagVersion = tagVersion.substring(1);
|
||||
}
|
||||
|
||||
if (pubspecVersion != tagVersion) {
|
||||
throw Exception(
|
||||
'pubspec version ($pubspecVersion) and tag version ($tagVersion) are different');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user