ci: build release action #9
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Flutter Build | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java JDK | |
uses: actions/setup-java@v4.2.1 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Flutter action | |
# You may pin to the exact commit or the version. | |
# uses: subosito/flutter-action@1c5eb12d812966ca84680edc38353a0851c8fd56 | |
uses: subosito/flutter-action@v2.14.0 | |
with: | |
# The Flutter version to make available on the path | |
flutter-version: # optional, default is any | |
# The Flutter build release channel | |
channel: # optional, default is stable | |
# Cache the Flutter SDK | |
cache: # optional, default is false | |
# Identifier for the Flutter SDK cache | |
cache-key: # optional, default is flutter-:os:-:channel:-:version:-:arch:-:hash: | |
# Identifier for the Dart .pub-cache cache | |
pub-cache-key: # optional, default is flutter-pub:os:-:channel:-:version:-:arch:-:hash: | |
# Flutter SDK cache path | |
cache-path: # optional, default is ${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch: | |
# Flutter pub cache path | |
pub-cache-path: # optional, default is default | |
# The architecture of Flutter SDK executable (x64 or arm64) | |
architecture: # optional, default is ${{ runner.arch }} | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
- name: Build APK | |
run: flutter build apk --release | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: app-release.apk | |
path: build/app/outputs/flutter-apk/app-release.apk | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: app-release.apk | |
# Destination path. Supports basic tilde expansion. Defaults to $GITHUB_WORKSPACE | |
path: # optional | |
# A glob pattern matching the artifacts that should be downloaded. Ignored if name is specified. | |
pattern: # optional | |
# When multiple artifacts are matched, this changes the behavior of the destination directories. If true, the downloaded artifacts will be in the same directory specified by path. If false, the downloaded artifacts will be extracted into individual named directories within the specified path. | |
merge-multiple: # optional, default is false | |
# The GitHub token used to authenticate with the GitHub API. This is required when downloading artifacts from a different repository or from a different workflow run. If this is not specified, the action will attempt to download artifacts from the current repository and the current workflow run. | |
github-token: # optional | |
# The repository owner and the repository name joined together by "/". If github-token is specified, this is the repository that artifacts will be downloaded from. | |
repository: # optional, default is ${{ github.repository }} | |
# The id of the workflow run where the desired download artifact was uploaded from. If github-token is specified, this is the run that artifacts will be downloaded from. | |
run-id: # optional, default is ${{ github.run_id }} | |
- name: GH Release | |
# You may pin to the exact commit or the version. | |
# uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 | |
uses: softprops/action-gh-release@v2.0.5 | |
with: | |
# Note-worthy description of changes in release | |
body: # optional | |
# Path to load note-worthy description of changes in release from | |
body_path: # optional | |
# Gives the release a custom name. Defaults to tag name | |
name: # optional | |
# Gives a tag name. Defaults to github.GITHUB_REF | |
tag_name: # optional | |
# Creates a draft release. Defaults to false | |
draft: # optional | |
# Identify the release as a prerelease. Defaults to false | |
prerelease: # optional | |
# Newline-delimited list of path globs for asset files to upload | |
files: # optional | |
# Fails if any of the `files` globs match nothing. Defaults to false | |
fail_on_unmatched_files: # optional | |
# Repository to make releases against, in <owner>/<repo> format | |
repository: # optional | |
# Authorized secret GitHub Personal Access Token. Defaults to github.token | |
token: # optional, default is ${{ github.token }} | |
# Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. | |
target_commitish: # optional | |
# If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored. | |
discussion_category_name: # optional | |
# Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise, a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes. | |
generate_release_notes: # optional | |
# Append to existing body instead of overwriting it. Default is false. | |
append_body: # optional | |
# Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Can be `true`, `false`, or `legacy`. Uses GitHub api default if not provided | |
make_latest: true |