mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-19 07:50:52 +01:00
Refactor the way the releases are built
This workflow is not manually triggered and can create automatically the appropriate tag. The build number is not increase to the next multiple of ten, to stay in sync with the iOS releases, which seem to cause more trouble and often need reuploads. The individual steps have been moved out to their own files, for better readability. We also now build the app for all supported platforms.
This commit is contained in:
23
.github/actions/flutter-common/action.yml
vendored
Normal file
23
.github/actions/flutter-common/action.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: 'Flutter common setup'
|
||||
description: 'Common steps needed to setup the application'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
flutter-version: 3.29.2
|
||||
cache: true
|
||||
|
||||
- name: Install Flutter dependencies
|
||||
run: flutter pub get
|
||||
shell: bash
|
||||
|
||||
- name: Install Flutter dependencies
|
||||
run: |
|
||||
dart --version
|
||||
flutter --version
|
||||
shell: bash
|
||||
73
.github/workflows/build-android.yml
vendored
Normal file
73
.github/workflows/build-android.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
name: Build Android
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
DECRYPTKEY_PLAYSTORE_SIGNING_KEY:
|
||||
required: true
|
||||
DECRYPTKEY_PROPERTIES:
|
||||
required: true
|
||||
jobs:
|
||||
build_android_apk:
|
||||
name: APK file
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Decrypt config files
|
||||
run: |
|
||||
cd ./fastlane/metadata/envfiles
|
||||
chmod +x ./decrypt_secrets.sh
|
||||
./decrypt_secrets.sh
|
||||
shell: bash
|
||||
env:
|
||||
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
|
||||
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
|
||||
|
||||
- name: Build APK
|
||||
run: flutter build apk --release
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-apk
|
||||
path: build/app/outputs/flutter-apk/app-release.apk
|
||||
|
||||
build_android_aab:
|
||||
name: AAB file
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Common setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Decrypt config files
|
||||
run: |
|
||||
cd ./fastlane/metadata/envfiles
|
||||
chmod +x ./decrypt_secrets.sh
|
||||
./decrypt_secrets.sh
|
||||
shell: bash
|
||||
env:
|
||||
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
|
||||
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
|
||||
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
|
||||
|
||||
- name: Build AAB
|
||||
run: flutter build appbundle --release
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-aab
|
||||
path: build/app/outputs/bundle/release/app-release.aab
|
||||
47
.github/workflows/build-apple.yml
vendored
Normal file
47
.github/workflows/build-apple.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
name: Build Apple
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
required: true
|
||||
type: string
|
||||
jobs:
|
||||
build_ios:
|
||||
name: iOS
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Build .app
|
||||
run: flutter build ios --release --no-codesign
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-ios
|
||||
path: build/ios/iphoneos/Runner.app
|
||||
|
||||
build_macos:
|
||||
name: macOS
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Build .app
|
||||
run: flutter build macos --release
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-macos
|
||||
path: build/macos/Build/Products/Release/wger.app
|
||||
37
.github/workflows/build-linux.yml
vendored
Normal file
37
.github/workflows/build-linux.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
#name: Build Linux
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
required: true
|
||||
type: string
|
||||
jobs:
|
||||
build_linux:
|
||||
name: Flathub
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Common setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
# Compare with list of available packages on the runner:
|
||||
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
|
||||
- name: Build application for linux
|
||||
run: |
|
||||
# ninja-build
|
||||
sudo apt install -y pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev --no-install-recommends
|
||||
flutter build linux --release
|
||||
cd flatpak/scripts
|
||||
dart pub get
|
||||
dart flatpak_packager.dart --meta ../flatpak_meta.json --addTodaysVersion ${{inputs.ref}}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-linux
|
||||
path: |
|
||||
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.tar.gz
|
||||
flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.sha256
|
||||
127
.github/workflows/build-release.yml
vendored
127
.github/workflows/build-release.yml
vendored
@@ -1,127 +0,0 @@
|
||||
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.29.2
|
||||
|
||||
- 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
|
||||
|
||||
- name: Build APK
|
||||
run: flutter build apk --release
|
||||
|
||||
- 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: github-actions@github.com
|
||||
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 github-actions@github.com
|
||||
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 }}
|
||||
26
.github/workflows/build-windows.yml
vendored
Normal file
26
.github/workflows/build-windows.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
required: true
|
||||
type: string
|
||||
jobs:
|
||||
build_windows:
|
||||
name: Windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Build .exe
|
||||
run: flutter build windows --release
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-windows
|
||||
path: build\windows\x64\runner\Release\wger.exe
|
||||
47
.github/workflows/bump-version.yml
vendored
Normal file
47
.github/workflows/bump-version.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
app_version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
determine_version:
|
||||
name: Create tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # needed to push changes
|
||||
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Validate version
|
||||
run: |
|
||||
RELEASE_VERSION="${{ inputs.app_version }}"
|
||||
if [[ ! "${{ inputs.app_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Error: Input version '${{ inputs.app_version }}' is not in X.Y.Z format."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# In order to make sure the build number is the same across all platforms,
|
||||
# increase to the next multiple of 10. This is needed because the iOS process
|
||||
# is a bit more brittle and might need to be repeated if the App needs
|
||||
# to be re-submitted.
|
||||
- name: Bump pubspec version
|
||||
run: |
|
||||
CURRENT_BUILD=$(flutter pub run cider version | cut -d '+' -f 2)
|
||||
NEXT_BUILD=$(( (CURRENT_BUILD / 10 + 1) * 10 ))
|
||||
flutter pub run cider version ${{ inputs.app_version }}+${NEXT_BUILD}
|
||||
|
||||
- name: Commit pubspec
|
||||
run: |
|
||||
git config user.name Github-Actions
|
||||
git config user.email github-actions@github.com
|
||||
git add pubspec.yaml
|
||||
git tag ${{ inputs.app_version }}
|
||||
git commit -m "Bump version to $( flutter pub run cider version )"
|
||||
git push origin HEAD:master
|
||||
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -9,21 +9,17 @@ on:
|
||||
paths:
|
||||
- '**.dart'
|
||||
- 'pubspec.yaml'
|
||||
workflow_call: { }
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
cache: true
|
||||
channel: 'stable'
|
||||
flutter-version: '3.29.x'
|
||||
|
||||
- run: dart --version
|
||||
- run: flutter --version
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
||||
186
.github/workflows/make-release.yml
vendored
Normal file
186
.github/workflows/make-release.yml
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
name: Build release artefacts
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Version to tag and release (X.Y.Z)
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
|
||||
ci:
|
||||
name: CI
|
||||
uses: ./.github/workflows/ci.yml
|
||||
|
||||
determine_version:
|
||||
needs: ci
|
||||
name: Prepare
|
||||
uses: ./.github/workflows/bump-version.yml
|
||||
with:
|
||||
app_version: ${{ github.event.inputs.version }}
|
||||
|
||||
build_linux:
|
||||
name: Linux
|
||||
needs: determine_version
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
|
||||
|
||||
build_android:
|
||||
name: Android
|
||||
needs: determine_version
|
||||
uses: ./.github/workflows/build-android.yml
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
secrets:
|
||||
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
|
||||
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
|
||||
|
||||
build_apple:
|
||||
name: Apple
|
||||
needs: determine_version
|
||||
uses: ./.github/workflows/build-apple.yml
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
|
||||
build_windows:
|
||||
name: Microsoft
|
||||
needs: determine_version
|
||||
uses: ./.github/workflows/build-windows.yml
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
|
||||
upload_play_store:
|
||||
name: Upload to Play Store
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build_android
|
||||
- build_linux
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Download builds
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: /tmp/
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.4
|
||||
|
||||
- name: Decrypt config files
|
||||
run: |
|
||||
cd ./fastlane/metadata/envfiles
|
||||
chmod +x ./decrypt_secrets.sh
|
||||
./decrypt_secrets.sh
|
||||
shell: bash
|
||||
env:
|
||||
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
|
||||
|
||||
- name: Upload build to Play Store
|
||||
run: |
|
||||
mkdir -p ./build/app/outputs/bundle/release/
|
||||
cp /tmp/builds-aab/app-release.aab ./build/app/outputs/bundle/release/app-release.aab
|
||||
bundle install
|
||||
bundle exec fastlane android production
|
||||
|
||||
#
|
||||
# This is currently commented out since the iOS upload are currently being handled
|
||||
# by the fastlane script in the ios folder. We use the account of pthaler for this
|
||||
# and he runs the script manually.
|
||||
#
|
||||
|
||||
# upload_app_store:
|
||||
# name: Upload to App Store (placeholder)
|
||||
# runs-on: ubuntu-latest
|
||||
# needs:
|
||||
# - build_android
|
||||
# - build_apple
|
||||
# steps:
|
||||
# - name: Checkout application
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# ref: feature/build-process
|
||||
# # ref: ${{ github.event.inputs.version }}
|
||||
#
|
||||
# - name: Common flutter setup
|
||||
# uses: ./.github/actions/flutter-common
|
||||
#
|
||||
# - name: Download builds
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# path: /tmp/
|
||||
#
|
||||
# - name: Upload build to App Store
|
||||
# run: |
|
||||
# # bundle exec fastlane todo
|
||||
|
||||
make_gh_release:
|
||||
if: false
|
||||
name: Make Github Release
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- upload_play_store
|
||||
- build_linux
|
||||
- build_windows
|
||||
- build_apple
|
||||
|
||||
steps:
|
||||
- name: Download builds
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Make Github release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ inputs.version }}
|
||||
files: |
|
||||
builds-aab/app-release.aab
|
||||
builds-apk/app-release.apk
|
||||
builds-linux/wger-linux-x86_64.tar.gz
|
||||
builds-linux/wger-linux-x86_64.sha256
|
||||
builds-ios/Runner.app
|
||||
builds-macos/wger.app
|
||||
|
||||
generate_fathub_manifest:
|
||||
if: false
|
||||
runs-on: ubuntu-latest
|
||||
name: Upload flathub manifest
|
||||
needs:
|
||||
- make_gh_release
|
||||
steps:
|
||||
- name: Checkout application
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Common flutter setup
|
||||
uses: ./.github/actions/flutter-common
|
||||
|
||||
- name: Generate 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: github-actions@github.com
|
||||
target-branch: release-${{ github.event.inputs.version }}
|
||||
create-target-branch-if-needed: true
|
||||
commit-message: Update to ${{ github.event.inputs.version }}
|
||||
|
||||
Reference in New Issue
Block a user