Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto publish action #73 #78

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Publish to pub.dev

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
31 changes: 22 additions & 9 deletions .github/workflows/update_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,44 @@ on:
workflow_dispatch:

jobs:
generate:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

with:
fetch-depth: 0 # Needed for git describe

- uses: dart-lang/setup-dart@v1

- 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: Commit and Push Updated Files
- 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" || echo "Nothing to commit!"
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"
Loading