-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (84 loc) · 2.9 KB
/
build.yml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build
on:
push:
branches:
- 'main'
- 'develop'
tags:
- '*'
pull_request:
branches:
- 'develop'
workflow_dispatch:
jobs:
archive-changelog:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Save changelog
if: startsWith(github.ref, 'refs/tags/')
run: cp 'changelogs/CHANGELOG - latest.md' 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'
- name: Commit changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
git config --global user.name 'Github Actions'
git config --global user.email '[email protected]'
git add 'changelogs/CHANGELOG - ${{ github.ref_name }}.md'
git commit -am "Save changelog"
git push
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Decrypt
run: gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.KEYPASSWORD }}" --output ./android/app/keystore/upload-keystore.jks ./android/app/keystore/upload-keystore.jks.gpg
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: "17.x"
cache: 'gradle'
- uses: subosito/flutter-action@v2
with:
flutter-version-file: 'pubspec.yaml'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Start release build
if: startsWith(github.ref, 'refs/tags/')
run: flutter build apk
env:
storePassword: ${{ secrets.STOREPASSWORD }}
keyPassword: ${{ secrets.KEYPASSWORD }}
keyAlias: 'upload'
storeFile: './keystore/upload-keystore.jks'
- name: Start debug build
if: startsWith(github.ref, 'refs/tags/') != true
run: flutter build apk --debug
env:
storePassword: ${{ secrets.STOREPASSWORD }}
keyPassword: ${{ secrets.KEYPASSWORD }}
keyAlias: 'upload'
storeFile: './keystore/upload-keystore.jks'
- name: Archive build artefact
uses: actions/upload-artifact@v4
with:
name: build
path: build/app/outputs/flutter-apk/*.apk
- name: Rename apk
if: startsWith(github.ref, 'refs/tags/')
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/${{ github.ref_name }}-release.apk
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: 'changelogs/CHANGELOG - latest.md'
token: ${{ secrets.GITHUB_TOKEN }}
files: build/app/outputs/flutter-apk/${{ github.ref_name }}-release.apk