diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 4bfa886..b3adb34 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -13,9 +13,9 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - # Test latest stable, beta, and dev channels + last stable release + # Test latest stable, beta, dev, and main channels + last stable release # prior to the introduction of the unified `dart` developer tool. - sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta] + sdk: [stable, beta, dev, main, 2.9.3, 2.12.0-29.10.beta] steps: - uses: actions/checkout@v2 - uses: ./ diff --git a/README.md b/README.md index 263a45f..b912a8d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,17 @@ This [GitHub Action]() installs and sets up of a Dart SDK for use in actions by: # Usage -## Basic +## Inputs + +The action takes the following inputs: + + * `sdk`: Which SDK version to setup. Can be specified using one of two forms: + * A specific SDK version, e.g. `2.7.2` or `2.12.0-1.4.beta` + * A release channel, which will install the latest build from that channel. + Available channels are `stable`, `beta`, `dev`, and `main`. See + https://dart.dev/tools/sdk/archive for details. + +## Basic example Install the latest stable SDK, and run Hello World. @@ -37,7 +47,7 @@ jobs: run: dart bin/hello_world.dart ``` -## Check static analysis, formatting, and tests +## Check static analysis, formatting, and test example Various static checks: @@ -62,7 +72,7 @@ Various static checks: run: dart test ``` -## Matrix testing +## Matrix testing example You can create matrix jobs that run tests on multiple operating systems, and multiple versions of the Dart SDK. @@ -101,7 +111,7 @@ jobs: run: dart test ``` -## Testing older Dart SDKs +## Testing older Dart SDKs example The Dart SDK continously evolves, and new features and tools are added. The Dart 2.10 SDK introduced a new unified `dart` developer tool, which is what we use in @@ -154,6 +164,10 @@ jobs: # Version history +## v0.3 + + * Added support for installing SDKs from the `main` channel. + ## v0.2 * Added support for installing a specific SDK version (e.g. `2.10.0`). diff --git a/setup.sh b/setup.sh index 1b75710..1b749c9 100755 --- a/setup.sh +++ b/setup.sh @@ -3,7 +3,7 @@ ############################################################################### # Bash script that downloads and does setup for a Dart SDK. # # Takes three params; first listed is the default: # -# $1: Dart SDK version/channel: stable|beta|dev| # +# $1: Dart SDK version/channel: stable|beta|dev|main| # # $2: Dart channel (DEPRECATED): stable|beta|dev # # $3: OS: Linux|Windows|macOS # # $4: ARCH: x64|ia32 # @@ -23,7 +23,7 @@ CHANNEL= VERSION= # Check for a specific version -if [[ $SDK == stable || $SDK == beta || $SDK == dev ]] +if [[ $SDK == stable || $SDK == beta || $SDK == dev || $SDK == main ]] then CHANNEL=$SDK VERSION=latest @@ -37,6 +37,10 @@ else elif [[ "$SDK" == *"beta"* ]] then CHANNEL=beta + elif [[ "$SDK" == *"main"* ]] + then + echo -e "::error::Versions cannot be specified for builds from the main channel." + exit 1 fi fi @@ -48,7 +52,13 @@ echo "Installing Dart SDK version \"${VERSION}\" from the ${CHANNEL} channel on # Calculate download Url. Based on: # https://dart.dev/tools/sdk/archive#download-urls PREFIX="https://storage.googleapis.com/dart-archive/channels" -URL="${PREFIX}/${CHANNEL}/release/${VERSION}/sdk/dartsdk-${OS}-${ARCH}-release.zip" +BUILD="sdk/dartsdk-${OS}-${ARCH}-release.zip" +if [[ $SDK == main ]] +then + URL="${PREFIX}/be/raw/latest/${BUILD}" +else + URL="${PREFIX}/${CHANNEL}/release/${VERSION}/${BUILD}" +fi echo "Downloading ${URL}..." # Download installation zip.