From 15d5e7f8b4e5067d9e7a889a9de9f8820cff0956 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Sun, 6 Oct 2024 02:45:36 +0200 Subject: [PATCH] feature: updated gh workflows --- .github/workflows/publish.yml | 72 ------------------- ...ersion.yml => tag_version_and_publish.yml} | 53 ++++++++++++-- CHANGELOG.md | 2 +- pubspec.yaml | 4 +- 4 files changed, 51 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/publish.yml rename .github/workflows/{tag_version.yml => tag_version_and_publish.yml} (54%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 9993b70..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Publish to pub.dev - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' # tag-pattern on pub.dev: 'v{{version}}' - -jobs: - publish: - runs-on: self-hosted - - permissions: - id-token: write - - steps: - - uses: actions/checkout@v4 - - - name: Set up Node.js 18 - uses: actions/setup-node@v4 - with: - node-version: '18.x' - - - name: Install Landa Messenger CLI - run: npm install @landamessenger/landa-messenger-api -g - - - uses: subosito/flutter-action@v1 - with: - channel: 'stable' - flutter-version: '3.24.3' - - - run: flutter pub get - - - run: dart pub publish --dry-run - - - run: dart pub publish -f - - - name: Handle job completion - if: always() - run: | - if [ "${{ job.status }}" == "failure" ]; then - landa-messenger-api chat-send \ - --id "${{ secrets.CHAT_ID }}" \ - --api_key "${{ secrets.CHAT_KEY }}" \ - --title "🔴 Pub Publish Failed" \ - --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ - --url "https://github.com/landamessenger/object/actions/workflows/publish.yml" \ - --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ - --background_color "#55000000" \ - --text_color "#FFFFFFFF" - elif [ "${{ job.status }}" == "cancelled" ]; then - landa-messenger-api chat-send \ - --id "${{ secrets.CHAT_ID }}" \ - --api_key "${{ secrets.CHAT_KEY }}" \ - --title "🟠 Pub Publish Canceled" \ - --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ - --url "https://github.com/landamessenger/object/actions/workflows/publish.yml" \ - --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ - --background_color "#55000000" \ - --text_color "#FFFFFFFF" - else - landa-messenger-api chat-send \ - --id "${{ secrets.CHAT_ID }}" \ - --api_key "${{ secrets.CHAT_KEY }}" \ - --title "🟢 Pub Publish Passed" \ - --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ - --url "https://github.com/landamessenger/object/actions/workflows/publish.yml" \ - --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ - --background_color "#55000000" \ - --text_color "#FFFFFFFF" - fi - - diff --git a/.github/workflows/tag_version.yml b/.github/workflows/tag_version_and_publish.yml similarity index 54% rename from .github/workflows/tag_version.yml rename to .github/workflows/tag_version_and_publish.yml index 13fa64e..00ce666 100644 --- a/.github/workflows/tag_version.yml +++ b/.github/workflows/tag_version_and_publish.yml @@ -1,4 +1,4 @@ -name: Tag Version on Push to Master +name: Tag Version and Publish on Push to Master on: push: @@ -46,7 +46,7 @@ jobs: --api_key "${{ secrets.CHAT_KEY }}" \ --title "🔴 Creation Tag Failed" \ --body "${{ github.repository }}: Tag v${{ env.VERSION }}" \ - --url "https://github.com/landamessenger/object/actions/workflows/tag_version.yml" \ + --url "https://github.com/landamessenger/object/actions/workflows/tag_version_and_publish.yml" \ --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ --background_color "#55000000" \ --text_color "#FFFFFFFF" @@ -56,7 +56,7 @@ jobs: --api_key "${{ secrets.CHAT_KEY }}" \ --title "🟠 Creation Tag Canceled" \ --body "${{ github.repository }}: Tag v${{ env.VERSION }}" \ - --url "https://github.com/landamessenger/object/actions/workflows/tag_version.yml" \ + --url "https://github.com/landamessenger/object/actions/workflows/tag_version_and_publish.yml" \ --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ --background_color "#55000000" \ --text_color "#FFFFFFFF" @@ -66,8 +66,51 @@ jobs: --api_key "${{ secrets.CHAT_KEY }}" \ --title "🟢 Creation Tag Passed" \ --body "${{ github.repository }}: Tag v${{ env.VERSION }}" \ - --url "https://github.com/landamessenger/object/actions/workflows/tag_version.yml" \ + --url "https://github.com/landamessenger/object/actions/workflows/tag_version_and_publish.yml" \ --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ --background_color "#55000000" \ --text_color "#FFFFFFFF" - fi \ No newline at end of file + fi + + - run: flutter pub get + + - run: dart pub publish --dry-run + + - run: dart pub publish -f + + - name: Handle publish job completion + if: always() + run: | + if [ "${{ job.status }}" == "failure" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🔴 Pub Publish Failed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/object/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + elif [ "${{ job.status }}" == "cancelled" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟠 Pub Publish Canceled" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/object/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + else + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟢 Pub Publish Passed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/object/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + fi + + diff --git a/CHANGELOG.md b/CHANGELOG.md index b0522cc..3e159f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.2.5 +## 1.2.6 * Generating constructors. diff --git a/pubspec.yaml b/pubspec.yaml index 81c7cdb..616307e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: object description: "Simplify the process of converting Dart objects to JSON and vice versa, making it easier to work with JSON data in Dart applications." -version: 1.2.5 +version: 1.2.6 homepage: https://landamessenger.com repository: https://github.com/landamessenger/object @@ -12,7 +12,7 @@ dependencies: flutter: sdk: flutter analyzer: ^6.2.0 # android ios linux macos web windows - cloud_firestore: ^5.4.3 # android ios macos web + cloud_firestore: ^5.4.4 # android ios macos web intl: ^0.19.0 # android ios linux macos web windows yaml: ^3.1.2 # android ios linux macos web windows