Skip to content

Commit 2e8f301

Browse files
authored
Merge pull request #776 from wger-project/feature/build-process
Refactor the way the releases are built
2 parents ffb3008 + b10e698 commit 2e8f301

33 files changed

+1783
-315
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Flutter common setup'
2+
description: 'Common steps needed to setup the application'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
8+
- name: Setup Flutter
9+
uses: subosito/flutter-action@v2
10+
with:
11+
channel: stable
12+
flutter-version: 3.29.2
13+
cache: true
14+
15+
- name: Install Flutter dependencies
16+
run: flutter pub get
17+
shell: bash
18+
19+
- name: Install Flutter dependencies
20+
run: |
21+
dart --version
22+
flutter --version
23+
shell: bash
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build Android
2+
on:
3+
workflow_call:
4+
inputs:
5+
ref:
6+
required: true
7+
type: string
8+
secrets:
9+
DECRYPTKEY_PLAYSTORE_SIGNING_KEY:
10+
required: true
11+
DECRYPTKEY_PROPERTIES:
12+
required: true
13+
jobs:
14+
build_android_apk:
15+
name: APK file
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout application
19+
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ inputs.ref }}
22+
23+
- name: Common flutter setup
24+
uses: ./.github/actions/flutter-common
25+
26+
- name: Decrypt config files
27+
run: |
28+
cd ./fastlane/metadata/envfiles
29+
chmod +x ./decrypt_secrets.sh
30+
./decrypt_secrets.sh
31+
shell: bash
32+
env:
33+
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
34+
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
35+
36+
- name: Build APK
37+
run: flutter build apk --release
38+
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
name: builds-apk
42+
path: build/app/outputs/flutter-apk/app-release.apk
43+
44+
build_android_aab:
45+
name: AAB file
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout application
49+
uses: actions/checkout@v4
50+
with:
51+
ref: ${{ inputs.ref }}
52+
53+
- name: Common setup
54+
uses: ./.github/actions/flutter-common
55+
56+
- name: Decrypt config files
57+
run: |
58+
cd ./fastlane/metadata/envfiles
59+
chmod +x ./decrypt_secrets.sh
60+
./decrypt_secrets.sh
61+
shell: bash
62+
env:
63+
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
64+
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
65+
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
66+
67+
- name: Build AAB
68+
run: flutter build appbundle --release
69+
70+
- uses: actions/upload-artifact@v4
71+
with:
72+
name: builds-aab
73+
path: build/app/outputs/bundle/release/app-release.aab

.github/workflows/build-apple.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build Apple
2+
on:
3+
workflow_call:
4+
inputs:
5+
ref:
6+
required: true
7+
type: string
8+
jobs:
9+
build_ios:
10+
name: iOS
11+
runs-on: macos-latest
12+
steps:
13+
- name: Checkout application
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ inputs.ref }}
17+
18+
- name: Common flutter setup
19+
uses: ./.github/actions/flutter-common
20+
21+
- name: Build .app
22+
run: flutter build ios --release --no-codesign
23+
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: builds-ios
27+
path: build/ios/iphoneos/Runner.app
28+
29+
build_macos:
30+
name: macOS
31+
runs-on: macos-latest
32+
steps:
33+
- name: Checkout application
34+
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ inputs.ref }}
37+
38+
- name: Common flutter setup
39+
uses: ./.github/actions/flutter-common
40+
41+
- name: Build .app
42+
run: flutter build macos --release
43+
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: builds-macos
47+
path: build/macos/Build/Products/Release/wger.app

.github/workflows/build-linux.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#name: Build Linux
2+
on:
3+
workflow_call:
4+
inputs:
5+
ref:
6+
required: true
7+
type: string
8+
jobs:
9+
build_linux:
10+
name: Flathub
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout application
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ inputs.ref }}
17+
18+
- name: Common setup
19+
uses: ./.github/actions/flutter-common
20+
21+
# Compare with list of available packages on the runner:
22+
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
23+
- name: Build application for linux
24+
run: |
25+
# ninja-build
26+
sudo apt install -y pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev --no-install-recommends
27+
flutter build linux --release
28+
cd flatpak/scripts
29+
dart pub get
30+
dart flatpak_packager.dart --meta ../flatpak_meta.json --addTodaysVersion ${{inputs.ref}}
31+
32+
- uses: actions/upload-artifact@v4
33+
with:
34+
name: builds-linux
35+
path: |
36+
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.tar.gz
37+
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.sha256

.github/workflows/build-release.yml

Lines changed: 0 additions & 127 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
ref:
5+
required: true
6+
type: string
7+
jobs:
8+
build_windows:
9+
name: Windows
10+
runs-on: windows-latest
11+
steps:
12+
- name: Checkout application
13+
uses: actions/checkout@v4
14+
with:
15+
ref: ${{ inputs.ref }}
16+
17+
- name: Common flutter setup
18+
uses: ./.github/actions/flutter-common
19+
20+
- name: Build .exe
21+
run: flutter build windows --release
22+
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: builds-windows
26+
path: build\windows\x64\runner\Release\wger.exe

.github/workflows/bump-version.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
app_version:
5+
required: true
6+
type: string
7+
8+
jobs:
9+
determine_version:
10+
name: Create tag
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Checkout application
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # needed to push changes
18+
19+
- name: Common flutter setup
20+
uses: ./.github/actions/flutter-common
21+
22+
- name: Validate version
23+
run: |
24+
RELEASE_VERSION="${{ inputs.app_version }}"
25+
if [[ ! "${{ inputs.app_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
26+
echo "Error: Input version '${{ inputs.app_version }}' is not in X.Y.Z format."
27+
exit 1
28+
fi
29+
30+
# In order to make sure the build number is the same across all platforms,
31+
# increase to the next multiple of 10. This is needed because the iOS process
32+
# is a bit more brittle and might need to be repeated if the App needs
33+
# to be re-submitted.
34+
- name: Bump pubspec version
35+
run: |
36+
CURRENT_BUILD=$(flutter pub run cider version | cut -d '+' -f 2)
37+
NEXT_BUILD=$(( (CURRENT_BUILD / 10 + 1) * 10 ))
38+
flutter pub run cider version ${{ inputs.app_version }}+${NEXT_BUILD}
39+
40+
- name: Commit pubspec
41+
run: |
42+
git config user.name Github-Actions
43+
git config user.email [email protected]
44+
git add pubspec.yaml
45+
git tag ${{ inputs.app_version }}
46+
git commit -m "Bump version to $( flutter pub run cider version )"
47+
git push origin HEAD:master

0 commit comments

Comments
 (0)