Skip to content

Commit 2e6385c

Browse files
authored
Merge pull request #413 from wger-project/feature/flatpak-build
Also auto build flatpak installation files on release
2 parents f58f61e + 1c56688 commit 2e6385c

File tree

1 file changed

+75
-30
lines changed

1 file changed

+75
-30
lines changed
Lines changed: 75 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
name: Google Play release
1+
name: Build release artefacts
22
on:
33
push:
44
tags:
55
- 'v[0-9]+.[0-9]+.[0-9]+'
66

7+
defaults:
8+
run:
9+
working-directory: wger
10+
711
jobs:
812
deploy_android:
913
runs-on: ubuntu-latest
1014
steps:
11-
- name: Checkout code
15+
- name: Checkout application code
1216
uses: actions/checkout@v2
17+
with:
18+
path: wger
19+
20+
- name: Checkout flathub repo
21+
uses: actions/checkout@v3
22+
with:
23+
repository: wger-project/test
24+
path: flathub
1325

1426
- name: Setup Java
1527
uses: actions/setup-java@v1
@@ -19,13 +31,21 @@ jobs:
1931
- name: Setup Ruby
2032
uses: ruby/setup-ruby@v1
2133
with:
22-
ruby-version: '3'
34+
ruby-version: 3
2335

2436
- name: Setup Flutter
2537
uses: subosito/flutter-action@v1
2638
with:
27-
channel: 'stable'
28-
flutter-version: '3.7.x'
39+
channel: stable
40+
flutter-version: 3.7.x
41+
42+
- name: Flutter info
43+
run: |
44+
dart --version
45+
flutter --version
46+
47+
- name: Install Flutter dependencies
48+
run: flutter pub get
2949

3050
- name: Decrypt config files
3151
run: |
@@ -37,39 +57,24 @@ jobs:
3757
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
3858
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
3959

40-
- name: Flutter info
41-
run: |
42-
dart --version
43-
flutter --version
44-
45-
- name: Install Flutter dependencies
46-
run: flutter pub get
47-
4860
- name: Extract version information
4961
run: |
5062
echo "VERSION_V=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
5163
echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -c 2-)" >> $GITHUB_ENV
5264
echo "BUILD=$(flutter pub run cider version | cut -d '+' -f 2)" >> $GITHUB_ENV
5365
54-
# Note: the original tag that triggered the workflow is in the form vX.Y.Z
55-
# but the pubspec.yaml is committed in the commit after that one.
56-
# Since we need the tag to point to the correct commit for other workflows
57-
# such as f-droid we need a way to correct it. Only moving the tag
58-
# would not work, as it would trigger this workflow again. So as
59-
# a workaround, we use the v-tag to trigger this workflow, add a new
60-
# one without the v and push it.
61-
- name: Bump version
66+
- name: Bump pubspec version
6267
run: |
6368
flutter pub run cider version ${{ env.VERSION }}+${{ env.BUILD }}
6469
flutter pub run cider bump build
6570
66-
git config user.name Github-actions
67-
git config user.email [email protected]
68-
git add .
69-
git commit -m "Bump version to $( flutter pub run cider version )"
70-
git tag ${{ env.VERSION }}
71-
git push origin HEAD:master --tags
72-
git push origin --delete ${{ env.VERSION_V }}
71+
- name: Build application for linux
72+
run: |
73+
sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
74+
flutter build linux --release
75+
cd flatpak/scripts
76+
dart pub get
77+
dart flatpak_packager.dart --meta ../flatpak_meta.json --github
7378
7479
- name: Build AAB
7580
run: flutter build appbundle --release
@@ -84,6 +89,46 @@ jobs:
8489
- name: Make Github release
8590
uses: softprops/action-gh-release@v1
8691
with:
87-
files: build/app/outputs/bundle/release/app-release.aab
8892
tag_name: ${{ env.VERSION }}
89-
body_path: CHANGELOG.md
93+
body_path: CHANGELOG.md
94+
files: |
95+
build/app/outputs/bundle/release/app-release.aab
96+
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.tar.gz
97+
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.sha256
98+
99+
- name: Generate flathub manifest
100+
run: |
101+
cd flatpak/scripts
102+
dart pub get
103+
dart manifest_generator.dart --meta ../flatpak_meta.json --github
104+
cp flatpak_generator_exports/de.wger.flutter.json ../../../flathub
105+
106+
- name: Push config to flathub repository
107+
uses: cpina/github-action-push-to-another-repository@main
108+
env:
109+
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
110+
with:
111+
source-directory: flathub
112+
destination-github-username: flathub
113+
destination-repository-name: de.wger.flutter
114+
user-email: [email protected]
115+
target-branch: flathub-${{ env.VERSION }}
116+
create-target-branch-if-needed: true
117+
commit-message: Update de.wger.flutter.json
118+
119+
# Note: the original tag that triggered the workflow is in the form vX.Y.Z
120+
# but the pubspec.yaml is committed in the commit after that one.
121+
# Since we need the tag to point to the correct commit for other workflows
122+
# such as f-droid we need a way to correct it. Only moving the tag
123+
# would not work, as it would trigger this workflow again. So as
124+
# a workaround, we use the v-tag to trigger this workflow, add a new
125+
# one without the v and push it.
126+
- name: Commit pubspec version and delete branch
127+
run: |
128+
git config user.name Github-actions
129+
git config user.email [email protected]
130+
git add .
131+
git commit -m "Bump version to $( flutter pub run cider version )"
132+
git tag ${{ env.VERSION }}
133+
git push origin HEAD:master --tags
134+
git push origin --delete ${{ env.VERSION_V }}

0 commit comments

Comments
 (0)