134 lines (116 loc) · 4.48 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
132
133
134
name: Build release artefacts
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
defaults:
run:
working-directory: wger
jobs:
deploy_android:
runs-on: ubuntu-latest
steps:
- name: Checkout application code
uses: actions/checkout@v2
with:
path: wger
- name: Checkout flathub repo
uses: actions/checkout@v3
with:
repository: wger-project/test
path: flathub
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 17.x
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: stable
flutter-version: 3.7.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 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
- name: Build AAB
run: flutter build appbundle --release
env:
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
- name: Upload build to Play Store
uses: maierj/fastlane-action@v2.2.1
with:
lane: production
- name: Make Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
body_path: CHANGELOG.md
files: |
build/app/outputs/bundle/release/app-release.aab
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
cp flatpak_generator_exports/de.wger.flutter.json ../../../flathub
- name: Push 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: flathub
destination-repository-name: de.wger.flutter
user-email: github-actions@github.com
target-branch: flathub-${{ env.VERSION }}
create-target-branch-if-needed: true
commit-message: Update de.wger.flutter.json
# 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 branch
run: |
git config user.name Github-actions
git config user.email github-actions@github.com
git add .
git commit -m "Bump version to $( flutter pub run cider version )"
git tag ${{ env.VERSION }}
git push origin HEAD:master --tags
git push origin --delete ${{ env.VERSION_V }}