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

support sdk version wildcard format #106

Merged
merged 8 commits into from Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml
Expand Up @@ -94,7 +94,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: [2.19.x, 3.1.x]
sdk: [2.19, 3.1]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,4 +1,4 @@
## v1.5.2-wip
## v1.6.0

* Add support for specifying a wildcard format for provisioning the latest patch
release of an SDK.
devoncarew marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -40,8 +40,8 @@ The action takes the following inputs:
* A release channel, which will install the latest build from that channel.
Available channels are `stable`, `beta`, `dev`, and `main`. See the
[Dart SDK archive](https://dart.dev/get-dart/archive) for details.
* A wildcard form for the latest patch release for a specific SDK version.
E.g., `2.19.x` will get the latest patch release for the 2.19 SDK.
* An SDK release version - e.g. `2.19` or `3.1`. This will install the
latest patch release for that specific release version.
* A specific SDK version, e.g. `2.19.0` or `2.12.0-1.4.beta`.

* `flavor`: Which build flavor to setup.
Expand Down
6 changes: 2 additions & 4 deletions action.yml
Expand Up @@ -7,10 +7,8 @@ inputs:
sdk:
description: >-
This can be either the channel to install (i.e., 'stable', 'beta', 'dev'),
a wildcard format for the latest patch release (i.e., `2.19.x`, `3.1.x`),
or a specific sdk version to install (i.e, '2.19.1', '3.0.0-1.4.beta').
Using one of the named channels instead of a version will give you the
latest version published of that channel.
an SDK release version (i.e., `2.19`, `3.1`), or a specific SDK version
(i.e, '2.19.1', '3.0.0-1.4.beta').
required: false
default: "stable"
architecture:
Expand Down
20 changes: 10 additions & 10 deletions dist/main.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sig.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/main.dart
Expand Up @@ -47,12 +47,12 @@ void main(List<String> args) async {
String version;
String channel;

if (sdk.endsWith('.x')) {
if (sdk.split('.').length == 2) {
// Handle the wildcard (`2.19`, `3.1`, ...) format.
channel = 'stable';

// Find the latest version for 'sdk'.
final versionPrefix = sdk.substring(0, sdk.length - '.x'.length);
version = await findLatestSdkForRelease(versionPrefix);
// Find the latest version for the given sdk release.
version = await findLatestSdkForRelease(sdk);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the same but for beta releases? E.g. the latest version in a beta series? Or maybe 3.3.0-1.beta would give you 3.3.0-1.1.beta and later 3.3.0-1.2.beta and onwards.

Although in those cases you can kinda just follow the beta channel, although that would give potential breakages whenever a new beta series is dropped, whereas a patched beta is only more stable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like 3.1-beta? I.e., the latest beta for a given sdk release?

I don't think that's a common use case. I think testing against the latest stable is common, and testing against the upcoming releases (beta, dev, ...) is common. What this PR will help with is for people that want to test against specific SDKs (for example, the lower sdk constraint of their pubspec), but want the latest patch release for that SDK. Right now they're using 3.1.0 as a stand-in for that lower bounds, but I think they really want to test against 3.1.<latest patch>.

} else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') {
channel = sdk;
version =
Expand Down