-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (75 loc) · 2.76 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (75 loc) · 2.76 KB
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
name: Release
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.44.0"
channel: stable
cache: true
- name: Resolve Dart/Flutter dependencies
run: flutter pub get
# The drift / riverpod generators are needed because *.g.dart files
# are gitignored and not committed.
- name: Run code generators
run: dart run build_runner build --delete-conflicting-outputs
- name: Build release APK
run: flutter build apk --release
- name: Compute release identifiers
id: meta
run: |
base=$(grep '^version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1)
tag="v${base}-build.${{ github.run_number }}"
name="mappy ${base} (build ${{ github.run_number }})"
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "name=${name}" >> "$GITHUB_OUTPUT"
- name: Rename APK with version tag
id: apk
run: |
src=build/app/outputs/flutter-apk/app-release.apk
dst="build/app/outputs/flutter-apk/mappy-${{ steps.meta.outputs.tag }}.apk"
mv "$src" "$dst"
sha=$(sha256sum "$dst" | awk '{print $1}')
echo "path=${dst}" >> "$GITHUB_OUTPUT"
echo "sha256=${sha}" >> "$GITHUB_OUTPUT"
- name: Upload APK as workflow artifact
uses: actions/upload-artifact@v4
with:
name: mappy-${{ steps.meta.outputs.tag }}
path: ${{ steps.apk.outputs.path }}
if-no-files-found: error
retention-days: 30
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: ${{ steps.meta.outputs.name }}
generate_release_notes: true
# Public releases are downloadable without auth on public repos.
make_latest: "true"
body: |
Auto-built APK for commit ${{ github.sha }}.
**Install:** Download the `.apk` below on an Android device and open
it. You may need to allow "Install unknown apps" for your browser.
**Signing:** This build is signed with Flutter's debug keystore.
It will install fine but is not Play-Store-ready.
**SHA-256:** `${{ steps.apk.outputs.sha256 }}`
files: ${{ steps.apk.outputs.path }}