Fix ci scripts

This commit is contained in:
niuhuan 2022-06-03 14:58:25 +08:00
parent 97b26dbca5
commit 7024ab280a
4 changed files with 36 additions and 9 deletions

View File

@ -215,6 +215,19 @@ jobs:
cd ci cd ci
cp version.code.txt ../lib/assets/version.txt cp version.code.txt ../lib/assets/version.txt
- name: Upgrade deps version (Android)
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host != 'macos-latest' && startsWith(matrix.config.flutter_version, '3')
run: |
sed -i "s/another_xlider: 1.0.1+2/another_xlider: ^1.0.1+2/g" pubspec.yaml
sed -i "s/flutter_styled_toast: 2.0.0/flutter_styled_toast: ^2.0.0/g" pubspec.yaml
- name: Upgrade deps version (iOS)
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host == 'macos-latest' && startsWith(matrix.config.flutter_version, '3')
run: |
brew install gnu-sed
gsed -i "s/another_xlider: 1.0.1+2/another_xlider: ^1.0.1+2/g" pubspec.yaml
gsed -i "s/flutter_styled_toast: 2.0.0/flutter_styled_toast: ^2.0.0/g" pubspec.yaml
- name: Build (windows) - name: Build (windows)
if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'windows' if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'windows'
run: | run: |
@ -276,9 +289,11 @@ jobs:
go run ./cmd/upload_asset go run ./cmd/upload_asset
send_to_community: send_to_community:
name: CI is green needs:
- check_release
- build_release_assets
name: Send message to community
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -2,6 +2,7 @@ package main
import ( import (
"ci/commons" "ci/commons"
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/andersfylling/disgord" "github.com/andersfylling/disgord"
@ -50,7 +51,7 @@ func main() {
var discordChatIds []uint64 var discordChatIds []uint64
json.Unmarshal([]byte(discordChatIdsStr), &discordChatIds) json.Unmarshal([]byte(discordChatIdsStr), &discordChatIds)
if len(discordChatIds) > 0 { if len(discordChatIds) > 0 {
sendMessageToDiscord(tgToken, discordChatIds, message) sendMessageToDiscord(discordToken, discordChatIds, message)
} }
} }
} }
@ -72,11 +73,15 @@ func sendMessageToTg(token string, ids []int64, message string) {
} }
func sendMessageToDiscord(token string, ids []uint64, message string) { func sendMessageToDiscord(token string, ids []uint64, message string) {
client := disgord.New(disgord.Config{ client, err := disgord.NewClient(context.Background(), disgord.Config{
BotToken: token, BotToken: token,
}) })
if err != nil {
fmt.Sprintf("discord login failed : %v", err.Error())
return
}
for _, id := range ids { for _, id := range ids {
_, err := client.SendMsg(disgord.Snowflake(id), message) _, err = client.SendMsg(disgord.Snowflake(id), message)
if err != nil { if err != nil {
fmt.Sprintf("Send message to tg chat : %v (error : %v)", id, err.Error()) fmt.Sprintf("Send message to tg chat : %v (error : %v)", id, err.Error())
} else { } else {

View File

@ -7,7 +7,7 @@ packages:
name: another_xlider name: another_xlider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.0.1+2"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@ -164,7 +164,7 @@ packages:
name: flutter_styled_toast name: flutter_styled_toast
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.0.0"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:
@ -329,6 +329,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
permission_handler: permission_handler:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -32,8 +32,8 @@ dependencies:
event: ^2.0.5 event: ^2.0.5
flutter_search_bar: ^3.0.0-dev.1 flutter_search_bar: ^3.0.0-dev.1
flutter_svg: ^1.0.3 flutter_svg: ^1.0.3
flutter_styled_toast: ^2.1.3 flutter_styled_toast: 2.0.0
another_xlider: ^1.1.0 another_xlider: 1.0.1+2
scrollable_positioned_list: ^0.2.0-nullsafety.0 scrollable_positioned_list: ^0.2.0-nullsafety.0
permission_handler: ^8.3.0 permission_handler: ^8.3.0
url_launcher: ^6.0.9 url_launcher: ^6.0.9