-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (39 loc) · 1.31 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
on:
push:
branches:
- main
name: Build and Release My App
jobs:
build:
name: Build and Release new APK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: flutter build apk --release --split-per-abi
# Get the latest tag
- name: Get latest tag
id: tag
run: echo "::set-output name=TAG::$(git describe --tags --abbrev=0)"
# Extract the version number
- name: Extract version number
id: extract_version
run: echo "::set-output name=VERSION::${{ steps.tag.outputs.TAG#*v }}"
# Increment the version number
- name: Increment version number
id: increment_version
run: echo "::set-output name=NEW_VERSION::$(echo ${{ steps.extract_version.outputs.VERSION }} | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')"
# Push to Releases
- name: Push to Releases
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/release/*"
tag: ${{ steps.increment_version.outputs.NEW_VERSION }}
token: ${{ secrets.TOKEN }}