Skip to content

Commit

Permalink
Merge pull request #562 from leoafarias/fix/deployment-reference
Browse files Browse the repository at this point in the history
Fix deployment reference
  • Loading branch information
leoafarias authored Sep 29, 2023
2 parents 19984a3 + 8ae76bd commit 781cc21
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 73 deletions.
8 changes: 6 additions & 2 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
25 changes: 25 additions & 0 deletions .github/workflows/deploy_macos.yml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions .github/workflows/deploy_windows.yml
Original file line number Diff line number Diff line change
@@ -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
101 changes: 39 additions & 62 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Deploy Release

on:
workflow_dispatch:
# release:
# types: [published, released]
push:
tags:
- "v*"
Expand All @@ -28,72 +26,51 @@ 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:
CHOCOLATEY_TOKEN: ${{ secrets.CHOCOLATEY_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare environment
uses: ./.github/actions/prepare

- name: Deploy Chocolatey (Windows)
run: dart run grinder pkg-chocolatey-deploy
uses: ./.github/workflows/deploy_windows.yml

deploy-homebrew:
name: Deploy Homebrew
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 to Homebrew
run: dart run grinder pkg-homebrew-update

deploy-docker:
name: Docker Deploy (latest)
runs-on: ubuntu-latest
name: Deploy (Mac)
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 }}
uses: ./.github/workflows/deploy_macos.yml

# 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 }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: "Dart SDK version"
type: string
required: false
default: "stable"
default: "3.1.3"

pull_request:
paths-ignore:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 3.0.0-beta.1
## 3.0.0-beta.2

### Added

Expand Down
2 changes: 1 addition & 1 deletion bin/compile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Future<void> 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
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions lib/src/commands/commands.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion lib/src/version.g.dart

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

4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/testing_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TestCommandRunner {

Future<String> 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
Expand Down
4 changes: 2 additions & 2 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Future<void> 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);
Expand Down Expand Up @@ -97,7 +97,7 @@ Future<void> testSetup() async {
testDir.deleteSync(recursive: true);
}

runDartScript('bin/fvm.dart', arguments: ['install', 'stable']);
runDartScript('bin/main.dart', arguments: ['install', 'stable']);
}

@Task('Run tests')
Expand Down

0 comments on commit 781cc21

Please sign in to comment.