Skip to content

build workfllow

build workfllow #7

Workflow file for this run

name: Flutter CI
# This workflow is triggered on pushes to the repository.
on:
push:
branches:
- main
# on: push # Default will running for every branch.
jobs:
build:
# This job will run on ubuntu virtual machine
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-deap: 0
- name: Get next version
uses: reecetech/[email protected]
id: version
with:
release_branch: main
scheme: semver
increment: patch
- run: echo ${{ steps.version.outputs.version }}
- name: Set up JDK 17.0
uses: actions/setup-java@v1
with:
java-version: 17.0
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.19.2
- name: Install dependencies
run: flutter pub get --verbose
- name: Analyze project source
run: dart analyze
- name: Run tests
run: flutter test
# Build apk.
- name: build apk
run: flutter build apk
# Upload generated apk to the artifacts.
- name: relase output
uses: actions/upload-artifact@v1
with:
name: release-apk
path: build/app/outputs/apk/release/app-release.apk
- name: create-release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: Daily Release ${{ steps.version.outputs.version }}
draft: true
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/app/outputs/apk/release/app-release.apk
asset_name: treeMarked-daily-${{ steps.version.outputs.version }}.apk
asset_content_type: application/apk
- name: Publish release
uses: eregon/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}