-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- run lint - run test - build example app - deploy flutter plugin on pub.dev
- Loading branch information
Showing
6 changed files
with
182 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Flutter Build | ||
|
||
on: | ||
push: | ||
branches: [main, beta, alpha] | ||
|
||
# Cancel jobs and just run the last one | ||
concurrency: | ||
group: ${{ github.head_ref }}-build | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
working-directory: example/ | ||
|
||
jobs: | ||
build_ios: | ||
name: Build iOS | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: '12.x' | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '2.8.1' | ||
channel: 'stable' | ||
cache: true | ||
cache-key: flutter # optional, change this to force refresh cache | ||
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path | ||
|
||
- run: flutter pub get | ||
- run: flutter build ios --release --no-codesign | ||
|
||
build_android: | ||
name: Build Android | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: '12.x' | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '2.8.1' | ||
channel: 'stable' | ||
cache: true | ||
cache-key: flutter # optional, change this to force refresh cache | ||
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path | ||
|
||
- run: flutter pub get | ||
- run: flutter build appbundle |
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,34 @@ | ||
name: Publish Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '2.8.1' | ||
channel: 'stable' | ||
cache: true | ||
cache-key: flutter # optional, change this to force refresh cache | ||
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path | ||
- name: Install dependencies | ||
run: pub get | ||
|
||
- name: Prepare Env | ||
shell: bash | ||
env: | ||
PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }} | ||
PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }} | ||
PUB_DEV_PUBLISH_TOKEN_ENDPOINT: ${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }} | ||
PUB_DEV_PUBLISH_EXPIRATION: ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }} | ||
run: | | ||
sh ./prepare_deploy_env.sh | ||
- name: Check Publish Warnings | ||
run: pub publish --dry-run | ||
- name: Publish Package | ||
run: pub publish -f |
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,28 @@ | ||
name: Lint | ||
|
||
on: [push, pull_request] | ||
|
||
# Cancel jobs and just run the last one | ||
concurrency: | ||
group: ${{ github.head_ref }}-lint | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '2.8.1' | ||
channel: 'stable' | ||
cache: true | ||
cache-key: flutter # optional, change this to force refresh cache | ||
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path | ||
|
||
- name: Install dependencies | ||
run: flutter pub get | ||
|
||
- name: Analyze project source | ||
run: flutter analyze |
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,28 @@ | ||
name: Test | ||
|
||
on: [push, pull_request] | ||
|
||
# Cancel jobs and just run the last one | ||
concurrency: | ||
group: ${{ github.head_ref }}-unit-test | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit_test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '2.8.1' | ||
channel: 'stable' | ||
cache: true | ||
cache-key: flutter # optional, change this to force refresh cache | ||
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path | ||
|
||
- name: Install dependencies | ||
run: flutter pub get | ||
|
||
- name: Run tests | ||
run: flutter test |
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,4 +1,4 @@ | ||
The MIT License (MIT) | ||
MIT License | ||
|
||
Copyright (c) 2021 Customer IO | ||
|
||
|
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,38 @@ | ||
# This script creates/updates credentials.json file which is used | ||
# to authorize publisher when publishing packages to pub.dev | ||
# Source: https://birju.dev/posts/publish-your-flutter-package-using-github-actions/ | ||
|
||
# Checking whether the secrets are available as environment | ||
# variables or not. | ||
if [ -z "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_ACCESS_TOKEN environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_REFRESH_TOKEN environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_TOKEN_ENDPOINT environment variable" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${PUB_DEV_PUBLISH_EXPIRATION}" ]; then | ||
echo "Missing PUB_DEV_PUBLISH_EXPIRATION environment variable" | ||
exit 1 | ||
fi | ||
|
||
# Create credentials.json file. | ||
mkdir -p $HOME/.config/dart | ||
cat <<EOF > $HOME/.config/dart/pub-credentials.json | ||
{ | ||
"accessToken":"${PUB_DEV_PUBLISH_ACCESS_TOKEN}", | ||
"refreshToken":"${PUB_DEV_PUBLISH_REFRESH_TOKEN}", | ||
"tokenEndpoint":"${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}", | ||
"idToken":"${PUB_DEV_PUBLISH_TOKEN_ID}", | ||
"scopes":["https://www.googleapis.com/auth/userinfo.email","openid"], | ||
"expiration":${PUB_DEV_PUBLISH_EXPIRATION} | ||
} | ||
EOF |