Skip to content

Commit 709e97f

Browse files
chore(pub): bump version (#105)
* build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(dependencies): upgrade dependencies * chore(doc): upgrade docs dependencie constraint * feat(constant): create query param constant & injector constant * refactor(di): use injector constant * refactor(api_endpoint): update api endpoint implementation * refactor(color): use withValues * chore(dependencies): run melos upgrade * chore(pubs): add topics * test(data_source): fix test failed with variable data source * chore(deps): update dependency constraints * fix(comments): fix switched comment between detail and get method * chore(deps): upgrade to sdk 3.7 * style(format): run dart format * feat([ANDROID] example): update example app android to kotlin dsl * fix(errors): proper error handling for api call * chore(deps): update dependency * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * refactor(workflow): update discord notification workflow (#101) * ci(workflow): make notify pr can be run manually * ci(workflow): exclude author from reviewer and mention author * ci(workflow): remove unused lcov pattern * ci(workflow): remove unused lcov pattern from main.yaml * ci(workflow): fix typo base network interceptor * ci(workflow): remove more unused pattern * ci(workflow): exclude generated file * ci(workflow): add more codeowner * ci(workflow): auto publish to pub.dev * feat(CENSUS): integrating census data endpoint (#96) * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(dependencies): upgrade dependencies * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#82) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump codecov/codecov-action from 4 to 5 (#84) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(puib): install meta * feat(entities): create census entitty * feat([DOMAIN] repositories): create census repository * refactor(usecase): update usecase contract * feat([DOMAIN] usecases): create get list of census use case * feat(domain): create domain barrel file * feat([FEATURES] census-data): create barrel file of censu data & export domain * feat([DATA] models): create census model * feat([DATA]): create barrel file for data * refactor([ENDPOINT]): add census endpoint * feat(features): export census data features * feat([DATA]): export data from feature barrel * feat([FAILURES]): create exception & failure for census data * feat([DATA] datasources): create census data remote data source * refactor([DATA] datasources): rename census data remote data source * feat([DATA] repositories): create census repository implementation * feat([INJECTOR]): create census data injector * feat(SDK): export census and register census data injector * test(fixture): create census list fixture * test([USECASE]): create get list of census test * refactor([EXCEPTIONS]): fix typo in exception nam * test([DATASOURCE]): create census remote data source * test([DATA][REPOSITORIES]): write unit test for census repository impl * feat(list): add census to list * fix([HTTP]): create new interoparibility client * feat(localizations): create localizations for census feature * feat(widgets): create pagination info widget * feat(widget): create property tile widget * feat([SHOWCASE][CENSUS]): create showcase example for censuses * feat(models): add census topic entity * fix(locale): fix wrong localization * feat([DOMAIN] repositories): add method to get census topics * feat([DOMAIN] usecases): create get list of census topic * feat([INJECTOR]): inject get list of census topic * feat([DATA] models): create census topic model * refactor(failures): create census topic exception and failure * refactor([NETWORK]): make network client cancellable * feat([DATASOURCE]): test cancelable and implement census topics * fix([DATASOURCE]): fix missing event param * refactor(constants): add event to query param constant * feat([DATA] repositories): create census repository impl * refactor(SDK): export census topic class * refactor(class): separate stadata list contract & implementation * feat([SHOWCASE][CENSUS_TOPIC]): create census topic showcase view * test(fixture): create fixture for census topic * test([USECASES]): write unit test for get list of census topics * test([DATASOURCES]): write test for getCensusTopics method * test([REPOSITORIES]): write unit test for getCensusTopics * feat(exception): create census area exception * feat(failure): create census area failure * style(linter): update linter rule for example app * feat(entities): create census area entity * feat(domain-repo): add getCensusArea method * feat(usecase): create get list of census area usecase * feat(models): create census area model * feat(datasource): add getCensusArea method * feat(data-repo): create implementation of getCensusArea * feat(injector): register get list of census area usecase * test(fixture): add fixture for census area list * test(usecase): create test for get list of census area * test(datasource): write test for getCensusArea method * feat(list): add censusEventAreas method to stadata list * feat(list): write down the censusEventAreas implementation * test(list): add missing dependency * fix(pub): add uses material design to root pub * ci(workflow): add ignore errors param * feat(git): add git attributes * ci(workflow): move ignore error param * feat(census_dataset): create census dataset entity * feat(repository): add getCensusDatasets method * refactor(repository): update topicID data type * feat(usecase): create get list of census datasets usecase * test(fixture): add fixture for census datasets * feat(model): create census dataset model * test(usecase): write unit test for get list of census datasets * refactor(repository): override getCensusDatasets in repository impl * chore(pub): run flutter upgrade * chore(pub): run flutter pub upgrade * chore(linter): use very good analysis versino 9 * style(code): run melos fix to fix code styling * feat(injector): register datasets list usecase to injector * chore(linter): add preserve traiing comma rule * style(code): run melos format * feat(list): add censusEventDataset method to stadata list * test(list): register get dataset list mock * fix(pub): add uses-material-design: true * refactor(census): fix linter error & add doc comment * chore(model): rename property & add doc comment * chore(example): create example for census datasets * feat(failures): create exception & failures for feature * fix(key): fix wrong key name for topik * refactor(census): refactor census related class * test(list): update list test * chore(pub): run flutter pub upgrade * feat(example): generate locale and routes * docs(docs): update docs * chore(census): update census feature implementation * chore(example): add example for census * refactor(gradle): update ndk version * ci(workflow): add new workflow to publish release * feat(script): create script to generate changelog * docs(scripts): create readme for changelog generator * docs(docs): update docs of stadata * refactor(git): update pr template * style(code): run dart fix & dart format * style(code): fix some linter issue * docs(docs): update roadmap & census docs * docs(claude): initialize claude code rule --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(pub): bump package version * docs(CHANGELOG): update changelog --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 1656f99 commit 709e97f

File tree

504 files changed

+80046
-20157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

504 files changed

+80046
-20157
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pubspec.lock linguist-generated=true

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
* @ryanaidilp @rii92
1+
* @ryanaidilp
2+
3+
app/* @rii92 @gerigeri00000 @devara46
4+
packages/* @rii92 @gerigeri00000 @devara46

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,62 @@
11
<!--
2-
Thanks for contributing!
2+
Thanks for contributing! / Terima kasih telah berkontribusi!
33
44
Provide a description of your changes below and a general summary in the title
5+
Berikan deskripsi perubahan Anda di bawah dan ringkasan umum di judul
56
67
Please look at the following checklist to ensure that your PR can be accepted quickly:
8+
Silakan lihat checklist berikut untuk memastikan PR Anda dapat diterima dengan cepat:
79
-->
810

9-
## Status
11+
## 📋 Description / Deskripsi
1012

11-
**READY/IN DEVELOPMENT/HOLD**
13+
<!--- Describe your changes in detail / Jelaskan perubahan Anda secara detail -->
1214

13-
## Description
15+
## 🔗 Related Issues / Issue Terkait
1416

15-
<!--- Describe your changes in detail -->
17+
<!--- Link any related issues, e.g., "Closes #123" / Tautkan issue terkait, contoh: "Closes #123" -->
1618

17-
## Type of Change
19+
## 🔄 Type of Change / Jenis Perubahan
1820

19-
<!--- Put an `x` in all the boxes that apply: -->
21+
<!--- Put an `x` in all the boxes that apply / Beri tanda `x` pada semua kotak yang sesuai: -->
2022

21-
- [ ] ✨ New feature (non-breaking change which adds functionality)
22-
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
23-
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
24-
- [ ] 🧹 Code refactor
25-
- [ ] ✅ Build configuration change
26-
- [ ] 📝 Documentation
27-
- [ ] 🗑️ Chore
23+
- [ ] ✨ New feature (non-breaking change which adds functionality) / Fitur baru (tidak merusak fungsionalitas yang ada)
24+
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) / Perbaikan bug (tidak merusak fungsionalitas yang ada)
25+
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) / Perubahan yang merusak (akan mengubah fungsionalitas yang ada)
26+
- [ ] 🧹 Code refactor / Refactor kode
27+
- [ ] ✅ Build configuration change / Perubahan konfigurasi build
28+
- [ ] 📝 Documentation / Dokumentasi
29+
- [ ] 🗑️ Chore / Maintenance
30+
31+
## ✅ Checklist
32+
33+
<!--- Please check all that apply / Silakan centang semua yang berlaku: -->
34+
35+
- [ ] I have read the [Contributing Guidelines](../GITHUB_CONTRIBUTION_WORKFLOW_EN.md) / Saya telah membaca [Panduan Kontribusi](../GITHUB_CONTRIBUTION_WORKFLOW.md)
36+
- [ ] My code follows the project's coding standards / Kode saya mengikuti standar coding proyek
37+
- [ ] I have added tests for my changes / Saya telah menambahkan test untuk perubahan saya
38+
- [ ] All existing tests pass / Semua test yang ada telah lulus
39+
- [ ] I have updated documentation if needed / Saya telah memperbarui dokumentasi jika diperlukan
40+
- [ ] I have updated the example app if needed / Saya telah memperbarui example app jika diperlukan
41+
- [ ] My commit messages follow the [convention](../GITHUB_CONTRIBUTION_WORKFLOW_EN.md#commit-message-convention) / Commit message saya mengikuti [konvensi](../GITHUB_CONTRIBUTION_WORKFLOW.md#konvensi-commit-message)
42+
43+
## 🧪 Testing / Pengujian
44+
45+
<!--- Describe how you tested your changes / Jelaskan bagaimana Anda menguji perubahan Anda -->
46+
47+
- [ ] Unit tests pass / Unit test lulus
48+
- [ ] Integration tests pass / Integration test lulus
49+
- [ ] Manual testing completed / Manual testing selesai
50+
- [ ] Example app runs without issues / Example app berjalan tanpa masalah
51+
52+
## 📱 Screenshots / Tangkapan Layar
53+
54+
<!--- If applicable, add screenshots to help explain your changes / Jika berlaku, tambahkan screenshot untuk membantu menjelaskan perubahan Anda -->
55+
56+
| Before / Sebelum | After / Sesudah |
57+
|------------------|-----------------|
58+
| <!-- Screenshot --> | <!-- Screenshot --> |
59+
60+
## 📄 Additional Notes / Catatan Tambahan
61+
62+
<!--- Any additional information that reviewers should know / Informasi tambahan yang perlu diketahui reviewer -->
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
import os
2+
import json
3+
import requests
4+
import yaml
5+
from pathlib import Path
6+
7+
def get_package_info():
8+
"""Get package name and current version from pubspec.yaml"""
9+
pubspec_path = Path("packages/stadata_flutter_sdk/pubspec.yaml")
10+
if not pubspec_path.exists():
11+
print("❌ pubspec.yaml not found")
12+
return None, None
13+
14+
with open(pubspec_path, 'r') as f:
15+
pubspec = yaml.safe_load(f)
16+
17+
return pubspec.get('name'), pubspec.get('version')
18+
19+
def get_pubdev_version(package_name):
20+
"""Get the latest version from pub.dev"""
21+
try:
22+
response = requests.get(f"https://pub.dev/api/packages/{package_name}")
23+
response.raise_for_status()
24+
data = response.json()
25+
return data.get('latest', {}).get('version')
26+
except requests.exceptions.RequestException as e:
27+
print(f"❌ Failed to fetch pub.dev info: {e}")
28+
return None
29+
30+
def get_last_notified_version():
31+
"""Get the last version we notified about from GitHub Actions cache/artifacts"""
32+
# For now, we'll use a simple approach with environment variables
33+
# In a production setup, you might want to use GitHub's cache or artifacts
34+
return os.getenv("LAST_NOTIFIED_VERSION")
35+
36+
def should_notify(local_version, pubdev_version, last_notified, force_check):
37+
"""Determine if we should send a notification"""
38+
if force_check:
39+
return True
40+
41+
if not pubdev_version:
42+
return False
43+
44+
# If local version matches pub.dev version and we haven't notified about this version
45+
if local_version == pubdev_version and pubdev_version != last_notified:
46+
return True
47+
48+
return False
49+
50+
def send_discord_notification(package_name, version, discord_webhook, discord_map):
51+
"""Send Discord notification about new pub.dev release"""
52+
pubdev_url = f"https://pub.dev/packages/{package_name}/versions/{version}"
53+
package_url = f"https://pub.dev/packages/{package_name}"
54+
55+
# Get package description from pub.dev API
56+
try:
57+
response = requests.get(f"https://pub.dev/api/packages/{package_name}")
58+
response.raise_for_status()
59+
package_data = response.json()
60+
description = package_data.get('latest', {}).get('pubspec', {}).get('description', '')
61+
except:
62+
description = "Flutter SDK for accessing BPS Indonesia statistical data"
63+
64+
embed = {
65+
"title": f"📦 Package Published to pub.dev!",
66+
"description": f"**{package_name}** version `{version}` is now available",
67+
"color": 0x0175C2, # pub.dev blue color
68+
"url": pubdev_url,
69+
"fields": [
70+
{
71+
"name": "📦 Package",
72+
"value": f"[{package_name}]({package_url})",
73+
"inline": True
74+
},
75+
{
76+
"name": "🏷️ Version",
77+
"value": f"`{version}`",
78+
"inline": True
79+
},
80+
{
81+
"name": "📄 Description",
82+
"value": description[:200] + ("..." if len(description) > 200 else ""),
83+
"inline": False
84+
},
85+
{
86+
"name": "🚀 Quick Install",
87+
"value": f"```yaml\ndependencies:\n {package_name}: ^{version}\n```",
88+
"inline": False
89+
},
90+
{
91+
"name": "🔗 Useful Links",
92+
"value": f"• [pub.dev Package]({package_url})\n• [API Documentation]({package_url}/doc/api)\n• [Example Usage]({package_url}/example)\n• [Changelog]({package_url}/changelog)",
93+
"inline": False
94+
}
95+
],
96+
"footer": {
97+
"text": "pub.dev notification • Automatically detected",
98+
"icon_url": "https://dart.dev/assets/img/shared/dart/icon/64.png"
99+
},
100+
"timestamp": None
101+
}
102+
103+
payload = {
104+
"content": f"🎉 **New Package Version on pub.dev!** @here",
105+
"embeds": [embed]
106+
}
107+
108+
try:
109+
response = requests.post(discord_webhook, json=payload)
110+
response.raise_for_status()
111+
print("✅ pub.dev notification sent to Discord.")
112+
return True
113+
except requests.exceptions.RequestException as e:
114+
print(f"❌ Failed to send Discord notification: {e}")
115+
return False
116+
117+
def main():
118+
discord_webhook = os.getenv("DISCORD_RELEASE_WEBHOOK")
119+
discord_map_json = os.getenv("DISCORD_MAP", "{}")
120+
force_check = os.getenv("FORCE_CHECK", "false").lower() == "true"
121+
122+
if not discord_webhook:
123+
print("❌ DISCORD_WEBHOOK not configured")
124+
return
125+
126+
# Parse Discord map
127+
discord_map = json.loads(discord_map_json)
128+
129+
# Get package information
130+
package_name, local_version = get_package_info()
131+
if not package_name or not local_version:
132+
print("❌ Could not determine package name or version")
133+
return
134+
135+
print(f"📦 Package: {package_name}")
136+
print(f"🏷️ Local version: {local_version}")
137+
138+
# Get pub.dev version
139+
pubdev_version = get_pubdev_version(package_name)
140+
print(f"🌐 pub.dev version: {pubdev_version}")
141+
142+
# Get last notified version (simplified approach)
143+
last_notified = get_last_notified_version()
144+
print(f"🔔 Last notified: {last_notified}")
145+
146+
# Check if we should notify
147+
if should_notify(local_version, pubdev_version, last_notified, force_check):
148+
print(f"📤 Sending notification for version {pubdev_version}")
149+
success = send_discord_notification(package_name, pubdev_version, discord_webhook, discord_map)
150+
151+
if success:
152+
# In a real implementation, you'd want to store this persistently
153+
print(f"✅ Successfully notified about version {pubdev_version}")
154+
# You could use GitHub's cache action or artifacts to store this
155+
# For now, we'll just output it
156+
print(f"::set-output name=notified_version::{pubdev_version}")
157+
else:
158+
print("❌ Failed to send notification")
159+
else:
160+
print("ℹ️ No notification needed")
161+
print(f" Local: {local_version}")
162+
print(f" pub.dev: {pubdev_version}")
163+
print(f" Last notified: {last_notified}")
164+
print(f" Force check: {force_check}")
165+
166+
if __name__ == "__main__":
167+
main()

0 commit comments

Comments
 (0)