From 521e991d40d751fd593d619b7de9f480c8c59b7e Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 29 Sep 2023 12:37:36 -0400 Subject: [PATCH 1/3] Fix deployment reference --- .github/workflows/release.yml | 82 ++++++++++++++++++++--------------- CHANGELOG.md | 2 +- bin/{fvm.dart => main.dart} | 0 lib/src/version.g.dart | 2 +- pubspec.yaml | 4 +- 5 files changed, 51 insertions(+), 39 deletions(-) rename bin/{fvm.dart => main.dart} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0101e0a1..26e95999 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,11 @@ name: Deploy Release on: workflow_dispatch: - # release: - # types: [published, released] + inputs: + jobToRun: + description: 'Which job to run?' + required: true + default: 'all' push: tags: - "v*" @@ -28,13 +31,16 @@ jobs: uses: ./.github/actions/prepare - name: Deploy Github - run: dart run grinder pkg-github-all + run: dart run grinder pkg-github-release + + - name: Deploy Github Linux + run: dart run grinder pkg-github-linux - name: Deploy to Pub run: dart run grinder pkg-pub-deploy deploy-windows: - name: Cholatey Deploy (Windows) + name: Deploy (Windows) needs: release runs-on: windows-latest env: @@ -46,11 +52,14 @@ jobs: - name: Prepare environment uses: ./.github/actions/prepare + - name: Deploy Github Windows + run: dart run grinder pkg-github-windows + - name: Deploy Chocolatey (Windows) run: dart run grinder pkg-chocolatey-deploy deploy-homebrew: - name: Deploy Homebrew + name: Deploy (Mac) runs-on: ubuntu-latest needs: release env: @@ -64,36 +73,39 @@ jobs: - name: Prepare environment uses: ./.github/actions/prepare + - name: Deploy Github Mac + run: dart run grinder pkg-github-macos + - name: Deploy to Homebrew run: dart run grinder pkg-homebrew-update - deploy-docker: - name: Docker Deploy (latest) - runs-on: ubuntu-latest - needs: release - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Prepare environment - uses: ./.github/actions/prepare - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push (latest) - id: docker_build_latest - uses: docker/build-push-action@v5 - with: - file: ./.docker/Dockerfile - push: true - tags: leoafarias/fvm:{{ github.event.release.tag_name }} + # deploy-docker: + # name: Docker Deploy (latest) + # runs-on: ubuntu-latest + # needs: release + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Prepare environment + # uses: ./.github/actions/prepare + + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v1 + + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v1 + + # - name: Login to DockerHub + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + + # - name: Build and push (latest) + # id: docker_build_latest + # uses: docker/build-push-action@v5 + # with: + # file: ./.docker/Dockerfile + # push: true + # tags: leoafarias/fvm:{{ github.event.release.tag_name }} diff --git a/CHANGELOG.md b/CHANGELOG.md index c3299f76..e62557a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 3.0.0-beta.1 +## 3.0.0-beta.2 ### Added diff --git a/bin/fvm.dart b/bin/main.dart similarity index 100% rename from bin/fvm.dart rename to bin/main.dart diff --git a/lib/src/version.g.dart b/lib/src/version.g.dart index a21b5a1c..c5af1920 100644 --- a/lib/src/version.g.dart +++ b/lib/src/version.g.dart @@ -1,3 +1,3 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - const packageVersion = '3.0.0-beta.1'; \ No newline at end of file + const packageVersion = '3.0.0-beta.2'; \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 437f2c3f..5e42a31a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,14 +1,14 @@ name: fvm description: A simple cli to manage Flutter SDK versions per project. Support channels, releases, and local cache for fast switching between versions. -version: 3.0.0-beta.1 +version: 3.0.0-beta.2 homepage: https://github.com/leoafarias/fvm environment: sdk: ">=2.17.0 <4.0.0" executables: - fvm: fvm + fvm: main dependencies: args: ^2.4.2 From 449622982c6cd9f382641216f15f19e60fa879f7 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 29 Sep 2023 12:40:21 -0400 Subject: [PATCH 2/3] Fix further scripts --- bin/compile.dart | 2 +- test/testing_utils.dart | 2 +- tool/grind.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/compile.dart b/bin/compile.dart index 23d555ac..c9637c1a 100644 --- a/bin/compile.dart +++ b/bin/compile.dart @@ -22,7 +22,7 @@ Future main() async { print('Compiling package...'); final compileResult = await Process.run( 'dart', - ['compile', 'exe', 'bin/fvm.dart', '-o', tempFile.path], + ['compile', 'exe', 'bin/main.dart', '-o', tempFile.path], ); // Error checking for compile process diff --git a/test/testing_utils.dart b/test/testing_utils.dart index 0a23da9c..3aa964ab 100644 --- a/test/testing_utils.dart +++ b/test/testing_utils.dart @@ -35,7 +35,7 @@ class TestCommandRunner { Future getStdout(String command) async { final executable = command.split(' ').first; - // Executable is on something like ./bin/fvm.dart + // Executable is on something like ./bin/main.dart // Which is the relactive to the Directory.current // However the script will be executed from a test directory on ctx.workingDirectory diff --git a/tool/grind.dart b/tool/grind.dart index 1a1645fb..9e5a9cf4 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -97,7 +97,7 @@ Future testSetup() async { testDir.deleteSync(recursive: true); } - runDartScript('bin/fvm.dart', arguments: ['install', 'stable']); + runDartScript('bin/main.dart', arguments: ['install', 'stable']); } @Task('Run tests') From 8ae76bd5b4bf591739add59ebcf83a03c84f3d7a Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 29 Sep 2023 13:08:11 -0400 Subject: [PATCH 3/3] Improved workflow --- .github/actions/prepare/action.yml | 8 ++++-- .github/workflows/deploy_macos.yml | 25 ++++++++++++++++++ .github/workflows/deploy_windows.yml | 23 ++++++++++++++++ .github/workflows/release.yml | 39 ++-------------------------- .github/workflows/test.yml | 2 +- lib/src/commands/commands.dart | 1 + lib/src/version.g.dart | 2 +- tool/grind.dart | 2 +- 8 files changed, 60 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/deploy_macos.yml create mode 100644 .github/workflows/deploy_windows.yml diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml index 0568bcc7..227aec5f 100644 --- a/.github/actions/prepare/action.yml +++ b/.github/actions/prepare/action.yml @@ -5,7 +5,8 @@ inputs: sdk-version: description: "Dart SDK version" required: false - default: "stable" + # 3.1.3 Version tested and within the compatibility + default: "3.1.3" runs: using: "composite" @@ -14,7 +15,7 @@ runs: - name: Setup Dart uses: dart-lang/setup-dart@v1 with: - sdk: ${{ inputs.sdk-version }} + sdk: ${{ inputs.sdk-version }} - name: Cache Dart dependencies uses: actions/cache@v3 @@ -28,6 +29,9 @@ runs: run: dart pub get shell: bash + - run: dart format --output=none --set-exit-if-changed . + shell: bash + - name: Analyze run: dart analyze --fatal-infos --fatal-warnings . shell: bash diff --git a/.github/workflows/deploy_macos.yml b/.github/workflows/deploy_macos.yml new file mode 100644 index 00000000..576e87af --- /dev/null +++ b/.github/workflows/deploy_macos.yml @@ -0,0 +1,25 @@ +name: Deploy Macos + +on: + workflow_call: + +jobs: + deploy-macos: + name: Deploy (Macos) + runs-on: macos-latest + env: + PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare environment + uses: ./.github/actions/prepare + + - name: Deploy Github Mac + run: dart run grinder pkg-github-macos + + - name: Deploy to Homebrew + run: dart run grinder pkg-homebrew-update diff --git a/.github/workflows/deploy_windows.yml b/.github/workflows/deploy_windows.yml new file mode 100644 index 00000000..27f57b23 --- /dev/null +++ b/.github/workflows/deploy_windows.yml @@ -0,0 +1,23 @@ +name: Deploy Windows + +on: + workflow_call: + +jobs: + deploy-windows: + name: Deploy (Windows) + runs-on: windows-latest + env: + CHOCOLATEY_TOKEN: ${{ secrets.CHOCOLATEY_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare environment + uses: ./.github/actions/prepare + + - name: Deploy Github Windows + run: dart run grinder pkg-github-windows + + - name: Deploy Chocolatey (Windows) + run: dart run grinder pkg-chocolatey-deploy \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26e95999..34293159 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,11 +2,6 @@ name: Deploy Release on: workflow_dispatch: - inputs: - jobToRun: - description: 'Which job to run?' - required: true - default: 'all' push: tags: - "v*" @@ -42,42 +37,12 @@ jobs: deploy-windows: name: Deploy (Windows) needs: release - runs-on: windows-latest - env: - CHOCOLATEY_TOKEN: ${{ secrets.CHOCOLATEY_TOKEN }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Prepare environment - uses: ./.github/actions/prepare - - - name: Deploy Github Windows - run: dart run grinder pkg-github-windows - - - name: Deploy Chocolatey (Windows) - run: dart run grinder pkg-chocolatey-deploy + uses: ./.github/workflows/deploy_windows.yml deploy-homebrew: name: Deploy (Mac) - runs-on: ubuntu-latest needs: release - env: - PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Prepare environment - uses: ./.github/actions/prepare - - - name: Deploy Github Mac - run: dart run grinder pkg-github-macos - - - name: Deploy to Homebrew - run: dart run grinder pkg-homebrew-update + uses: ./.github/workflows/deploy_macos.yml # deploy-docker: # name: Docker Deploy (latest) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f94ccbe4..a15f4192 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: description: "Dart SDK version" type: string required: false - default: "stable" + default: "3.1.3" pull_request: paths-ignore: diff --git a/lib/src/commands/commands.dart b/lib/src/commands/commands.dart index e69de29b..8b137891 100644 --- a/lib/src/commands/commands.dart +++ b/lib/src/commands/commands.dart @@ -0,0 +1 @@ + diff --git a/lib/src/version.g.dart b/lib/src/version.g.dart index c5af1920..d6093d20 100644 --- a/lib/src/version.g.dart +++ b/lib/src/version.g.dart @@ -1,3 +1,3 @@ // GENERATED CODE - DO NOT MODIFY BY HAND - const packageVersion = '3.0.0-beta.2'; \ No newline at end of file +const packageVersion = '3.0.0-beta.2'; diff --git a/tool/grind.dart b/tool/grind.dart index 9e5a9cf4..df635858 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -54,7 +54,7 @@ Future buildVersion() async { } // Add comment on top of the const that this file is generated by this command - String fileContent = '// GENERATED CODE - DO NOT MODIFY BY HAND\n\n '; + String fileContent = '// GENERATED CODE - DO NOT MODIFY BY HAND\n\n'; fileContent += "const packageVersion = '$version';"; versionFile.writeAsStringSync(fileContent);