-
Notifications
You must be signed in to change notification settings - Fork 9
120 lines (115 loc) · 4.23 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
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: Run fastlane
run: bundle exec fastlane deploy_production
release_github:
name: Release on GitHub
environment: release
needs: [ get_version, release_play_store ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: Build app (fat APK)
run: flutter build apk --release
- name: Build app (per ABIs)
run: flutter build apk --release --split-per-abi
- name: Create a folder to store the APKs to release
run: mkdir release
- name: Move and rename APKs
run: |
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/github-script@v7.0.1
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/*