-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
on: [push] | ||
|
||
jobs: | ||
hello_world_job: | ||
test_job: | ||
runs-on: ubuntu-latest | ||
name: Test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Test action | ||
uses: ./ | ||
with: | ||
credential: "{}" | ||
skip_test: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# actions-flutter-pub-publisher | ||
|
||
This action publishing the Flutter plugin. | ||
|
||
## Inputs | ||
|
||
### `credential` | ||
|
||
**Required** Google Account credential. | ||
|
||
### `skip_test` | ||
|
||
**Optional** Skip test. Default: `false` | ||
|
||
## Example usage | ||
|
||
```yaml | ||
name: Publish plugin | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Publish | ||
uses: actions/actions-flutter-pub-publisher@v1 | ||
with: | ||
credential: ${{ secrets.CREDENTIAL_JSON }} | ||
skip_test: true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
# action.yml | ||
name: 'Publish Dart package' | ||
description: 'Publish Dart package' | ||
inputs: | ||
credential: | ||
description: 'Google Account credential' | ||
required: true | ||
skip_test: | ||
description: '(Optional) Skip test (default: false)' | ||
required: false | ||
default: false | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh -l | ||
|
||
set -e | ||
|
||
check_credentials() { | ||
echo "Check credentials" | ||
if [ -z "$INPUT_CREDENTIAL" ]; then | ||
echo "Missing credential" | ||
exit 1 | ||
fi | ||
echo "OK" | ||
} | ||
|
||
copy_credential() { | ||
echo "Copy credentials" | ||
mkdir -p .pub-cache | ||
cat <<EOF > ~/.pub-cache/credentials.json | ||
$INPUT_CREDENTIAL | ||
EOF | ||
echo "OK" | ||
} | ||
|
||
run_test_if_needed() { | ||
if "${INPUT_SKIP_TEST}"; then | ||
echo 'Skip test' | ||
else | ||
echo "Run test" | ||
flutter pub get | ||
flutter test | ||
fi | ||
} | ||
|
||
publish_package() { | ||
echo "Publish to Pub" | ||
flutter pub pub publish --dry-run | ||
flutter pub pub publish -f | ||
} | ||
|
||
check_credentials | ||
copy_credential | ||
run_test_if_needed | ||
publish_package |