From 0819b8b20150333409d95b05869424d77e230511 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sun, 23 Mar 2025 22:11:24 +0100 Subject: [PATCH] some initial changes --- .gitea/workflows/frontend_build-android.yaml | 67 ----------------- .../workflows/frontend_build-app-android.yaml | 72 ++++++++++++++++++ .gitea/workflows/frontend_build-app-ios.yaml | 73 +++++++++++++++++++ .gitea/workflows/frontend_build-web.yaml | 34 --------- .../frontend_trigger_deployment.yaml | 39 ---------- 5 files changed, 145 insertions(+), 140 deletions(-) delete mode 100644 .gitea/workflows/frontend_build-android.yaml create mode 100644 .gitea/workflows/frontend_build-app-android.yaml create mode 100644 .gitea/workflows/frontend_build-app-ios.yaml delete mode 100644 .gitea/workflows/frontend_build-web.yaml delete mode 100644 .gitea/workflows/frontend_trigger_deployment.yaml diff --git a/.gitea/workflows/frontend_build-android.yaml b/.gitea/workflows/frontend_build-android.yaml deleted file mode 100644 index e119bad..0000000 --- a/.gitea/workflows/frontend_build-android.yaml +++ /dev/null @@ -1,67 +0,0 @@ -on: - pull_request: - branches: - - main - paths: - - frontend/** - - -name: Build and release debug APK - -jobs: - build: - name: Build APK - runs-on: ubuntu-latest - steps: - - - name: Install prerequisites - run: | - apt-get update - apt-get install -y jq - - - uses: https://gitea.com/actions/checkout@v4 - - - - uses: https://github.com/actions/setup-java@v4 - with: - java-version: '17' - distribution: 'zulu' - - - name: Fix flutter SDK folder permission - run: git config --global --add safe.directory "*" - - - uses: https://github.com/subosito/flutter-action@v2 - with: - channel: stable - flutter-version: 3.22.0 - cache: true - - - name: Setup Android SDK - uses: https://github.com/android-actions/setup-android@v3 - - - run: flutter pub get - working-directory: ./frontend - - - name: Add required secrets - env: - ANDROID_SECRETS_PROPERTIES: ${{ secrets.ANDROID_SECRETS_PROPERTIES }} - run: | - echo "$ANDROID_SECRETS_PROPERTIES" >> ./android/secrets.properties - working-directory: ./frontend - - - name: Sanity check - run: | - ls - ls -lah android - working-directory: ./frontend - - - run: flutter build apk --debug --split-per-abi --build-number=${{ gitea.run_number }} - working-directory: ./frontend - - - name: Upload APKs to artifacts - uses: https://gitea.com/actions/upload-artifact@v3 - with: - name: app-release - path: frontend/build/app/outputs/flutter-apk/ - if-no-files-found: error - retention-days: 15 diff --git a/.gitea/workflows/frontend_build-app-android.yaml b/.gitea/workflows/frontend_build-app-android.yaml new file mode 100644 index 0000000..3d55849 --- /dev/null +++ b/.gitea/workflows/frontend_build-app-android.yaml @@ -0,0 +1,72 @@ +on: + pull_request: + branches: + - main + paths: + - frontend/** + + +name: Build and release debug APK + +defaults: + run: + working-directory: frontend/android + + +jobs: + build: + name: Build APK + runs-on: macos + env: + # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ gitea.workspace }}/frontend/android/Gemfile + + steps: + - uses: https://gitea.com/actions/checkout@v4 + + # Selfhosted actions require a few extra steps + - name: Install prerequisites + run: | + apt-get update + apt-get install -y jq + + - uses: https://github.com/actions/setup-java@v4 + with: + java-version: '17' + distribution: 'zulu' + + - name: Fix flutter SDK folder permission + run: git config --global --add safe.directory "*" + + - uses: https://github.com/subosito/flutter-action@v2 + with: + channel: stable + flutter-version: 3.22.0 + cache: true + + - name: Setup Android SDK + uses: https://github.com/android-actions/setup-android@v3 + + - run: flutter pub get + working-directory: ./frontend + + - name: Set up ruby env and install fastlane + uses: https://github.com/ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: Add required secrets + run: | + echo "${{ secrets.ANDROID_SECRET_PROPERTIES_BASE64 }}" | base64 -d > secrets.properties + echo "${{ secrets.ANDROID_GOOGLE_PLAY_JSON_BASE64 }}" | base64 -d > google-key.json + echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > release.keystore + working-directory: android + + - name: Run fastlane lane + run: bundle exec fastlane deploy_release + working-directory: android + env: + BUILD_NUMBER: ${{ github.run_number }} + # BUILD_NAME is implicitly available + GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }} diff --git a/.gitea/workflows/frontend_build-app-ios.yaml b/.gitea/workflows/frontend_build-app-ios.yaml new file mode 100644 index 0000000..a6ab07c --- /dev/null +++ b/.gitea/workflows/frontend_build-app-ios.yaml @@ -0,0 +1,73 @@ +on: + pull_request: + branches: + - main + paths: + - frontend/** + +name: Build and release debugging app to ios testflight + +defaults: + run: + working-directory: frontend/android + +jobs: + build: + runs-on: macos + env: + # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ gitea.workspace }}/frontend/ios/Gemfile + + steps: + - uses: https://gitea.com/actions/checkout@v4 + + - name: Set up ruby env + uses: https://github.com/ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: Install Flutter + uses: https://github.com/subosito/flutter-action@v2 + with: + channel: stable + flutter-version: 3.22.0 + cache: true + + - name: Infer version number from git tag + id: version + env: + REF_NAME: ${{ gitea.ref_name }} + run: + # remove the 'v' prefix from the tag name + echo "BUILD_NAME=${REF_NAME//v}" >> $GITHUB_ENV + + - name: Setup SSH key for match git repo + # and mark the host as known + run: | + echo $MATCH_REPO_SSH_KEY | base64 --decode > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -p 2222 git.kluster.moll.re > ~/.ssh/known_hosts + env: + MATCH_REPO_SSH_KEY: ${{ secrets.IOS_MATCH_REPO_SSH_KEY_BASE64 }} + + - name: Install dependencies and clean up + run: | + flutter pub get + bundle exec pod install + flutter clean + bundle exec pod cache clean --all + working-directory: ios + + - name: Run fastlane lane + run: bundle exec fastlane deploy_release --verbose + working-directory: ios + env: + BUILD_NUMBER: ${{ gitea.run_number }} + # BUILD_NAME is implicitly available + GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }} + IOS_ASC_KEY_ID: ${{ secrets.IOS_ASC_KEY_ID }} + IOS_ASC_ISSUER_ID: ${{ secrets.IOS_ASC_ISSUER_ID }} + IOS_ASC_KEY: ${{ secrets.IOS_ASC_KEY }} + MATCH_PASSWORD: ${{ secrets.IOS_MATCH_PASSWORD }} + IOS_GOOGLE_MAPS_API_KEY: ${{ secrets.IOS_GOOGLE_MAPS_API_KEY }} diff --git a/.gitea/workflows/frontend_build-web.yaml b/.gitea/workflows/frontend_build-web.yaml deleted file mode 100644 index 05f28d4..0000000 --- a/.gitea/workflows/frontend_build-web.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# on: -# pull_request: -# branches: -# - main -# paths: -# - frontend/** - - -# name: Build web - -# jobs: -# build: -# name: Build Web -# runs-on: ubuntu-latest -# steps: - -# - name: Install prerequisites -# run: | -# sudo apt-get update -# sudo apt-get install -y xz-utils - -# - uses: actions/checkout@v4 - -# - uses: https://github.com/subosito/flutter-action@v2 -# with: -# channel: stable -# flutter-version: 3.19.6 -# cache: true - -# - run: flutter pub get -# working-directory: ./frontend - -# - run: flutter build web -# working-directory: ./frontend diff --git a/.gitea/workflows/frontend_trigger_deployment.yaml b/.gitea/workflows/frontend_trigger_deployment.yaml deleted file mode 100644 index 1f32b0d..0000000 --- a/.gitea/workflows/frontend_trigger_deployment.yaml +++ /dev/null @@ -1,39 +0,0 @@ -on: - push: - tags: - - v* - -jobs: - push-to-remote: - # We want to use the macos runner provided by github actions. This requires to push to a remote first. - # After the push we can use the action under frontend/.github/actions/ to deploy properly using fastlane on macos. - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - path: 'src' - - - name: Checkout remote repository - uses: actions/checkout@v3 - with: - path: 'dest' - ref: 'main' - github-server-url: 'https://github.com' - repository: 'moll-re/anyway-frontend-builder' - token: ${{ secrets.PUSH_GITHUB_API_TOKEN }} - fetch-depth: 0 - persist-credentials: true - - - name: Copy files to remote repository - run: cp -r src/frontend/. dest/ - - - name: Commit and push changes - run: | - cd dest - git config --global user.email "me@moll.re" - git config --global user.name "[bot]" - git add . - git commit -m "Automatic code update for tag" - git tag -a ${{ github.ref_name }} -m "mirrored tag" - git push origin main --tags