Skip to content

Dependencies

Dependencies #1004

# This workflow contains checks that test whether there are outdated
# dependencies in the package or one of its examples. It is not part of the
# main workflows since it is only intended to notify the maintainers that
# they should update the package.
name: Dependencies
# Trigger the workflow whenever commits are pushed to the `main` branch or
# development branches with the `-ci` postfix that modify a `pubspec.yaml`
# file or the workflow file itself.
#
# Additionally, the workflow runs once every day at 6am on the `main` branch.
on:
push:
branches:
- "main"
- "*-ci"
paths:
- ".github/workflows/check-dependencies.yaml"
- "**/pubspec.yaml"
schedule:
- cron: "0 6 * * *"
jobs:
# This job runs the `dart pub outdated` command and uploads the JSON output
# as an artifact.
find-outdated-packages:
name: Find Outdated Packages
runs-on: ubuntu-latest
container:
image: dart:stable
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
- name: Print Dart SDK Version
run: dart --version
- name: Install Dependencies
run: dart pub get
- name: Find Outdated Packages
run: dart pub outdated --json > outdated.json
- name: Upload Output of `dart pub outdated`
uses: actions/upload-artifact@v4
with:
name: outdated
path: outdated.json
# This job checks the JSON output artifact of the `dart pub outdated`
# command. The `current` version field of all `packages` must be set to
# the `resolvable` version. Otherwise, this job fails. If there are
# packages with a newer version but that cannot be upgraded, because the
# version of the package is constrainted by a dependency, the job does not
# fail.
check-outdated-packages:
name: Check Outdated Packages
runs-on: ubuntu-latest
needs:
- find-outdated-packages
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
- name: Download Output of `dart pub outdated`
uses: actions/download-artifact@v4
with:
name: outdated
- name: Find Outdated Packages
run: 'jq -e "
[.packages
| .[]
| .current.version == .resolvable.version
] | all" outdated.json'