| name: package:timezone | |
| permissions: | |
| contents: read | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| with: | |
| persist-credentials: false | |
| - uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| with: | |
| persist-credentials: false | |
| - uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d | |
| 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@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 | |
| with: | |
| client-id: ${{ vars.ECOSYSTEM_BOT_CLIENT_ID }} | |
| private-key: ${{ secrets.ECOSYSTEM_BOT_PRIVATE_KEY }} | |
| permission-contents: write | |
| permission-pull-requests: write | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| persist-credentials: false | |
| - uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d | |
| 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}." | |
| env: | |
| STEPS_REFRESH_OUTPUTS_TZ_VERSION: ${{ steps.refresh.outputs.tz_version }} | |
| - name: Create Pull Request | |
| if: steps.check_changes.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@86c87cfdd87dd582eb8b8f226cfec4e09d825326 | |
| 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 |