-
Notifications
You must be signed in to change notification settings - Fork 37
52 lines (42 loc) · 1.62 KB
/
update_metadata.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Update Metadata
on:
schedule:
# At 12:00 AM, on day 1 of each month
- cron: "0 0 1 * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for git describe
- uses: dart-lang/setup-dart@v1
# using beta channel for the time being for using the `dart pub bump` command
with:
sdk: 'beta'
- name: Install dependencies
run: dart pub get
- name: Fetch LibPhoneNumber Metadata
run: curl -o resources/data_sources/PhoneNumberMetadata.xml https://raw.githubusercontent.com/google/libphonenumber/master/resources/PhoneNumberMetadata.xml
- name: Process Metadata
run: dart resources/data_sources/convert_metadata.dart
- name: Generate Files
run: |
dart pub get
dart resources/generate_files.dart && dart format lib/src && dart fix --apply
- name: Update Version and Create Tag
run: |
# Bump version
dart pub bump patch
# Get the new version for the commit message
NEW_VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //')
# Commit and push changes
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add .
git commit -m "Update Metadata and bump version to $NEW_VERSION" || exit 0
git push
# Create and push tag
git tag "v$NEW_VERSION"
git push origin "v$NEW_VERSION"