-
-
Notifications
You must be signed in to change notification settings - Fork 244
131 lines (114 loc) · 4.67 KB
/
build-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
name: Build release artefacts
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
deploy_android:
runs-on: ubuntu-latest
steps:
- name: Checkout application code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.x
- name: Flutter info
run: |
dart --version
flutter --version
- name: Install Flutter dependencies
run: flutter pub get
- name: Decrypt config files
run: |
cd ./fastlane/metadata/envfiles
chmod +x ./decrypt_secrets.sh
./decrypt_secrets.sh
env:
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
- name: Extract version information
run: |
echo "VERSION_V=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -c 2-)" >> $GITHUB_ENV
echo "BUILD=$(flutter pub run cider version | cut -d '+' -f 2)" >> $GITHUB_ENV
- name: Bump pubspec version
run: |
flutter pub run cider version ${{ env.VERSION }}+${{ env.BUILD }}
flutter pub run cider bump build
- name: Build application for linux
run: |
sudo apt update
sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
flutter build linux --release
cd flatpak/scripts
dart pub get
dart flatpak_packager.dart --meta ../flatpak_meta.json --github --addTodaysVersion ${{ env.VERSION }}
- name: Build AAB
run: flutter build appbundle --release
env:
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
- name: Build APK
run: flutter build apk --release
env:
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
- name: Upload build to Play Store
run: |
bundle install
bundle exec fastlane android production
- name: Make Github release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
files: |
build/app/outputs/bundle/release/app-release.aab
build/app/outputs/flutter-apk/app-release.apk
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.tar.gz
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.sha256
- name: Generate flathub manifest
run: |
cd flatpak/scripts
dart pub get
dart manifest_generator.dart --meta ../flatpak_meta.json --github
mkdir ../../flathub
cp flatpak_generator_exports/de.wger.flutter.json ../../flathub
cp flatpak_generator_exports/flathub.json ../../flathub
- name: Push updated config to flathub repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: flathub
destination-github-username: wger-project
destination-repository-name: de.wger.flutter
user-email: [email protected]
target-branch: release-${{ env.VERSION }}
create-target-branch-if-needed: true
commit-message: Update to ${{ env.VERSION }}
# Note: the original tag that triggered the workflow is in the form vX.Y.Z
# but the pubspec.yaml is committed in the commit after that one.
# Since we need the tag to point to the correct commit for other workflows
# such as f-droid we need a way to correct it. Only moving the tag
# would not work, as it would trigger this workflow again. So as
# a workaround, we use the v-tag to trigger this workflow, add a new
# one without the v and push it.
- name: Commit pubspec version and delete tag
run: |
git config user.name Github-Actions
git config user.email [email protected]
git checkout -b release-${{ env.VERSION }}
git add pubspec.yaml
git commit -m "Bump version to $( flutter pub run cider version )"
git push origin --delete ${{ env.VERSION_V }}
git push --set-upstream origin release-${{ env.VERSION }}