-
Notifications
You must be signed in to change notification settings - Fork 10
155 lines (150 loc) · 5.22 KB
/
release.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
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
155
name: Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
get_version:
name: Get the app version
environment: release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.echo_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get_version
uses: mikefarah/yq@master
with:
cmd: yq -r '.version' 'pubspec.yaml' | cut -d '+' -f 1
- name: Echo version
id: echo_version
run: echo "version=${{ steps.get_version.outputs.result }}" >> "$GITHUB_OUTPUT"
release_play_store:
name: Release on the Play Store
environment: release
needs: [ get_version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
- name: Add keystore
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > android/localmaterialnotes_keystore.jks
- name: Add key properties
run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" > android/key.properties
- name: Add fastlane supply key
run: echo "${{ secrets.FASTLANE_SUPPLY_KEY }}" | base64 -d > fastlane/localmaterialnotes_fastlane-supply_key.json
- name: Generate files
run: |
dart run build_runner build
flutter gen-l10n
- name: Run fastlane
run: bundle exec fastlane deploy_production
release_github:
name: Release on GitHub
environment: release
needs: [ get_version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Read Android NDK version
run: |
VERSION=$(cat .ndk-version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.VERSION }}
add-to-path: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
rustflags: ""
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
- name: Get dependencies
run: |
export PUB_CACHE=$HOME/.pub-cache
flutter pub get
- name: Setup Isar
run: |
sudo apt-get install -y tofrodos
fromdos .isar/tool/build_android.sh
bash scripts/isar/fdroid_build_isar.sh x86 arm64
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Add keystore
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > android/localmaterialnotes_keystore.jks
- name: Add key properties
run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" > android/key.properties
- name: Generate code
run: |
dart run build_runner build
flutter gen-l10n
- name: Build app (fat APK)
run: flutter build apk --release
- name: Build app (per ABIs)
run: flutter build apk --release --split-per-abi
- name: Move and rename APKs
run: |
mkdir release
mv build/app/outputs/flutter-apk/app-release.apk release/localmaterialnotes_v${{ needs.get_version.outputs.version }}.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk release/localmaterialnotes_armeabi-v7a_v${{ needs.get_version.outputs.version }}.apk
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk release/localmaterialnotes_arm64-v8a_v${{ needs.get_version.outputs.version }}.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk release/localmaterialnotes_x86_64_v${{ needs.get_version.outputs.version }}.apk
- name: Extract changelog
id: extract_changelog
uses: dahlia/submark@main
with:
input-file: CHANGELOG.md
heading-level: 2
heading-title-regex: ^${{ needs.get_version.outputs.version }}
omit-heading: true
- name: Create release tag
uses: actions/[email protected]
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ needs.get_version.outputs.version }}',
sha: context.sha
})
- name: Publish to GitHub releases
uses: softprops/action-gh-release@v2
with:
make_latest: true
name: v${{ needs.get_version.outputs.version }}
body: ${{ steps.extract_changelog.outputs.output-text }}
tag_name: v${{ needs.get_version.outputs.version }}
files: release/*