| name: package:timezone |
| permissions: read-all |
| |
| on: |
| # Run CI on all PRs (against any branch) and on pushes to the main branch. |
| push: |
| branches: [ main ] |
| paths: |
| - '.github/workflows/timezone.yml' |
| - 'pkgs/timezone/**' |
| pull_request: |
| paths: |
| - '.github/workflows/timezone.yml' |
| - 'pkgs/timezone/**' |
| workflow_dispatch: |
| schedule: |
| - cron: '0 0 * * 0' # weekly |
| |
| defaults: |
| run: |
| working-directory: pkgs/timezone |
| |
| jobs: |
| build: |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| sdk: [stable, dev] |
| steps: |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 |
| with: |
| sdk: ${{ matrix.sdk }} |
| - run: dart pub get |
| - run: dart analyze --fatal-infos |
| - run: dart format --output=none --set-exit-if-changed . |
| if: ${{ matrix.sdk == 'dev' }} |
| - run: dart test |
| |
| document: |
| needs: build |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 |
| with: |
| sdk: dev |
| - name: Install dependencies |
| run: | |
| dart pub get |
| dart pub global activate dartdoc |
| - name: Verify dartdoc |
| run: dart pub global run dartdoc \ |
| --no-generate-docs \ |
| --errors=unresolved-doc-reference,ambiguous-doc-reference,ambiguous-reexport,broken-link,deprecated,no-library-level-docs,unknown-directive,unknown-macro |
| |
| # Job to check for new TZ database updates |
| refresh-check: |
| runs-on: ubuntu-latest |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' |
| permissions: |
| contents: write |
| pull-requests: write |
| steps: |
| - name: Generate Dart Bot Token |
| id: generate-token |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 |
| with: |
| client-id: ${{ vars.ECOSYSTEM_BOT_CLIENT_ID }} |
| private-key: ${{ secrets.ECOSYSTEM_BOT_PRIVATE_KEY }} |
| |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| with: |
| token: ${{ steps.generate-token.outputs.token }} |
| |
| - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 |
| with: |
| sdk: dev |
| |
| - name: Install dependencies |
| run: dart pub get |
| |
| - name: Run refresh script |
| id: refresh |
| run: tool/refresh.sh |
| |
| - name: Check for changes |
| id: check_changes |
| run: | |
| if [ -n "$(git status --porcelain .)" ]; then |
| echo "changed=true" >> $GITHUB_OUTPUT |
| else |
| echo "changed=false" >> $GITHUB_OUTPUT |
| fi |
| |
| - name: Install changelog updater |
| if: steps.check_changes.outputs.changed == 'true' |
| run: | |
| dart install --git-path pkgs/repo_manage https://github.com/dart-lang/ecosystem.git |
| echo "$HOME/.local/state/Dart/install/bin" >> $GITHUB_PATH |
| |
| - name: Update changelog |
| if: steps.check_changes.outputs.changed == 'true' |
| run: report changelog "Update timezone database to ${{ steps.refresh.outputs.tz_version }}." |
| |
| - name: Create Pull Request |
| if: steps.check_changes.outputs.changed == 'true' |
| uses: peter-evans/create-pull-request@6fff569d741c6b8131d2a49663b16573ef90be31 |
| with: |
| token: ${{ steps.generate-token.outputs.token }} |
| committer: dart-ecosystem-bot <dart-ecosystem-bot@google.com> |
| author: dart-ecosystem-bot <dart-ecosystem-bot@google.com> |
| commit-message: "Update time zone data to ${{ steps.refresh.outputs.tz_version }}" |
| branch: "update-tzdb-${{ steps.refresh.outputs.tz_version }}" |
| title: "[refresh.sh] Update time zone data to TZDB ${{ steps.refresh.outputs.tz_version }}" |
| body: | |
| Automated update to the latest IANA Time Zone Database version ${{ steps.refresh.outputs.tz_version }}. |
| See the [IANA Time Zone Database homepage](https://www.iana.org/time-zones) for announcements and details on recent data changes. |
| delete-branch: true |