-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github actions ci/cd for android build
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
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,50 @@ | ||
name: Android CI/CD | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: subosito/flutter-action@v1.3.0 | ||
with: | ||
flutter-version: 1.17.0-dev.3.1 | ||
channel: beta | ||
- name: Flutter get dependencies | ||
run: flutter pub get | ||
- name: Get application version | ||
id: app_ver | ||
run: echo "::set-output name=app_ver::" "$(flutter pub run pubspec_semver:get_ver)" | ||
- name: Set application build number | ||
run: flutter pub run pubspec_semver:set_build ${{ github.run_id }} | ||
- name: Flutter config generate | ||
run: flutter pub run environment_config:generate | ||
env: | ||
LAST_FM_API_KEY: ${{ secrets.LAST_FM_API_KEY }} | ||
- name: Flutter build | ||
run: flutter build apk | ||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: "${{ github.run_id }}" | ||
release_name: "Build ${{ steps.app_ver.outputs.app_ver }}#${{ github.run_id }}" | ||
prerelease: true | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build/app/outputs/apk/release/app-release.apk | ||
asset_name: ${{ steps.app_ver.outputs.app_ver }}_${{ github.run_id }}.apk | ||
asset_content_type: application/zip |