diff --git a/.github/workflows/test_dart.yml b/.github/workflows/test_dart.yml new file mode 100644 index 0000000..900398b --- /dev/null +++ b/.github/workflows/test_dart.yml @@ -0,0 +1,18 @@ +on: + push: + branches: + - 'test/*' + - '!master' +jobs: + test_job: + runs-on: ubuntu-latest + name: Test + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Test action + uses: ./ + with: + credential: "{}" + flutter_package: false + skip_test: true diff --git a/.github/workflows/test.yml b/.github/workflows/test_flutter.yml similarity index 100% rename from .github/workflows/test.yml rename to .github/workflows/test_flutter.yml diff --git a/README.md b/README.md index 4b5e370..78cdfd4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ This action publishing the Flutter plugin. **Required** Google Account credential. +### `flutter_package` + +**Optional** Publish packages type. Default: `true` + ### `skip_test` **Optional** Skip test. Default: `false` @@ -30,8 +34,9 @@ jobs: - name: Checkout uses: actions/checkout@v1 - name: Publish - uses: sakebook/actions-flutter-pub-publisher@v1.0.3 + uses: sakebook/actions-flutter-pub-publisher@v1.1.0 with: credential: ${{ secrets.CREDENTIAL_JSON }} + flutter_package: false skip_test: true ``` diff --git a/action.yml b/action.yml index f273d79..23e84bc 100644 --- a/action.yml +++ b/action.yml @@ -1,10 +1,14 @@ # action.yml -name: 'Publish Dart package' -description: 'Publish Dart package' +name: 'Publish Dart/Flutter package' +description: 'Publish Dart/Flutter package' inputs: credential: description: 'Google Account credential' required: true + flutter_package: + description: '(Optional) Publish packages type. (default: true)' + required: false + default: true skip_test: description: '(Optional) Skip test (default: false)' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 25a4b62..490fac5 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,12 +30,26 @@ run_test_if_needed() { fi } -publish_package() { - echo "Publish to Pub" +publish_package_dart() { + echo "Publish dart package to Pub" + pub publish --dry-run + pub publish -f +} + +publish_package_flutter() { + echo "Publish flutter package to Pub" flutter pub pub publish --dry-run flutter pub pub publish -f } +publish_package() { + if "${INPUT_FLUTTER_PACKAGE}"; then + publish_package_flutter + else + publish_package_dart + fi +} + check_credentials copy_credential run_test_if_needed