This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
7 inject version number with workflow #50
Workflow file for this run
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. | |
# If branch, build name will be the branch name and the date of the day | |
# Else if tag, build name will be tag name | |
name: Build Binaries | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build_apk: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
- name: Get current date | |
id: date | |
run: echo "today=$(date +'%Y.%m.%d.%H')" >> $GITHUB_ENV | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: 3.19.0 | |
- run: flutter pub get | |
# - run: flutter test | |
# - name: Build linux version | |
# run: flutter build linux --release | |
- name: build apk with tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: flutter build apk --build-name ${{ steps.get_version.outputs.VERSION }} | |
- name: build appbundle with tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: flutter build appbundle --build-name ${{ steps.get_version.outputs.VERSION }} | |
- name: build apk with branch | |
if: (!startsWith(github.ref, 'refs/tags/')) | |
run: flutter build appbundle --build-name ${{ env.today }} | |
- name: build apk with branch | |
if: (!startsWith(github.ref, 'refs/tags/')) | |
run: flutter build appbundle --build-name ${{ env.today }} | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apk | |
path: build/app/outputs/flutter-apk/app-release.apk |