-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (149 loc) · 5.34 KB
/
release.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: App release
on:
push:
tags:
- 'release/*'
jobs:
check:
name: Check application
runs-on: ubuntu-latest
steps:
# Init
- name: Checkout repository
uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.2'
channel: stable
cache: true
- uses: actions/cache@v3
with:
path: |
~/.pub-cache/git
~/.pub-cache/hosted
- name: Check flutter installation
run: flutter --version
# Preparation
- name: Get dependencies
run: dart run melos bootstrap
# Checks
- name: Ensure that code is formatted correctly
run: dart run melos format --set-exit-if-changed --output none $(git ls-files | grep --colour=never -e ".*\.dart")
- name: Analyze code to find critical problems
run: dart run melos exec flutter analyze --no-fatal-infos
version_update:
name: Update pubspec version
needs: check
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.update_version.outputs.app_version }}
app_build_number: ${{ steps.update_version.outputs.app_build_number }}
tag_name: ${{ steps.get_tag.outputs.tag_name }}
branch: ${{ steps.find_branch.outputs.branch }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Tag Name
id: get_tag
run: echo "tag_name=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Find Branch Containing the Tag Commit
id: find_branch
run: |
BRANCH=$(git branch -r --contains $GITHUB_SHA | grep -v HEAD | head -n 1 | sed 's|origin/||')
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Checkout Branch
run: git checkout ${{ steps.find_branch.outputs.branch }}
- name: Update Version
id: update_version
run: tools/update-version.sh ${{ steps.get_tag.outputs.tag_name }} >> $GITHUB_OUTPUT
- name: Validate release notes
run: tools/validate-release-notes.sh ${{ steps.update_version.outputs.app_version }}
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add pubspec.yaml
git commit -m "Bump version to ${{ steps.update_version.outputs.app_version }}+${{ steps.update_version.outputs.app_build_number }} [skip ci]"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
git push origin ${{ steps.find_branch.outputs.branch }}
build:
name: Build android
needs: version_update
runs-on: ubuntu-latest
steps:
# Init
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ needs.version_update.outputs.branch }}
fetch-depth: 0
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.2'
channel: stable
cache: true
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '17'
- uses: actions/cache@v3
with:
path: |
~/.pub-cache/git
~/.pub-cache/hosted
- name: Check flutter and Java installation installation
run: |
flutter --version
java --version
# Preparation
- name: Get dependencies
run: dart run melos bootstrap
- name: Decode and save android keystore
run: |
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > $HOME/keystore.jks
- name: Save key.properties
run: |
touch android/key.properties
echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties
echo "storeFile=$HOME/keystore.jks" >> android/key.properties
# Build and upload
- name: Build APK
run: |
flutter build apk --flavor prod --split-per-abi
flutter build apk --flavor prod
TAG=foss tools/android/move-builds.sh
tools/android/check-cert.sh
- name: Upload FOSS APK Artifact
uses: actions/upload-artifact@v3
with:
name: artifacts-apk-foss
path: build/releases/android
release:
name: Release to GitHub actions
needs:
- build
- version_update
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download APKs Directory
uses: actions/download-artifact@v3
with:
name: artifacts-apk-foss
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.version_update.outputs.tag_name }}
name: v${{ needs.version_update.outputs.app_version }}
bodyFile: release_notes/${{ needs.version_update.outputs.app_version }}/github/RELEASE_NOTES.md
artifacts: 'artifacts-apk-foss/*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
draft: true