Skip to content

Commit

Permalink
Setting args
Browse files Browse the repository at this point in the history
  • Loading branch information
sakebook committed Oct 13, 2019
1 parent 4d55683 commit 52f657a
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
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
36 changes: 36 additions & 0 deletions README.md
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
```
8 changes: 8 additions & 0 deletions action.yml
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'
42 changes: 42 additions & 0 deletions entrypoint.sh
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

0 comments on commit 52f657a

Please sign in to comment.