Reputation: 685
I have a GitHub workflow for releasing nightly snapshots of the repository. This is how the workflow file looks right now:
# Define workflow name
name: main
# This workflow is triggered on pushes to the repository.
on:
push:
branches:
- main
jobs:
build:
# This job will run on windows virtual machine
runs-on: windows-latest
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
flutter-version: '3.3.7' # version of flutter
# Get flutter dependencies.
- run: flutter clean
- run: flutter pub get
# Build apk.
- run: flutter build apk --release
# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v1
with:
name: app-release # want to set current date time over here
path: build/app/outputs/flutter-apk/app-release.apk
I want current datetime as release apk name. However, I couldn't find any documentation on it. How should I do it?
Upvotes: 1
Views: 460
Reputation: 1583
You can specify versionName and versionCode in the android/local.properties
flutter.versionName=YOUR-DATE-HERE
flutter.versionCode=1
UPDATE
You can specify the exact file name of generated apk
file by modifying build.gradle
file
buildTypes {
applicationVariants.all{
variant ->
variant.outputs.each{
// on below line we are setting a name to our apk
output->
def formattedDate = new Date().format('yyyy-MM-dd-HH-mm-ss')
output.outputFileName = formattedDate
}
}
}
Upvotes: 1