From 1f1efec8045f04d0a536b679b6bf8b48bd356f4b Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sat, 19 Apr 2025 17:43:59 +0200 Subject: [PATCH] correctly infer version from tags --- .../workflows/frontend_build-app-android.yaml | 17 +++++++++-------- .gitea/workflows/frontend_build-app-ios.yaml | 15 ++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/frontend_build-app-android.yaml b/.gitea/workflows/frontend_build-app-android.yaml index bf234ed..617bcba 100644 --- a/.gitea/workflows/frontend_build-app-android.yaml +++ b/.gitea/workflows/frontend_build-app-android.yaml @@ -6,7 +6,7 @@ on: - frontend/** -name: Build and release debug APK +name: Build and release debug APK to testing track defaults: run: @@ -52,13 +52,14 @@ jobs: ruby-version: 3.3 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Infer version number from git tag - id: version - env: - REF_NAME: ${{ gitea.ref_name }} - run: + - name: Fetch tags from main branch + # since this workflow is triggered by a pull request, we want to match the latest tag of the main branch + id: build_name + run: | + git fetch origin main --tags + LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) # remove the 'v' prefix from the tag name - echo "BUILD_NAME=${REF_NAME//v}" >> $GITHUB_ENV + echo "BUILD_NAME=${LATEST_TAG//v}" >> $GITHUB_OUTPUT - name: Add required secret files run: | @@ -70,5 +71,5 @@ jobs: run: bundle exec fastlane deploy_beta env: BUILD_NUMBER: ${{ gitea.run_number }} - # BUILD_NAME is implicitly available + BUILD_NAME: ${{ steps.build_name.outputs.BUILD_NAME }} ANDROID_GOOGLE_MAPS_API_KEY: ${{ secrets.ANDROID_GOOGLE_MAPS_API_KEY }} diff --git a/.gitea/workflows/frontend_build-app-ios.yaml b/.gitea/workflows/frontend_build-app-ios.yaml index bb60e79..d55f41f 100644 --- a/.gitea/workflows/frontend_build-app-ios.yaml +++ b/.gitea/workflows/frontend_build-app-ios.yaml @@ -42,13 +42,14 @@ jobs: ruby-version: 3.3 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Infer version number from git tag - id: version - env: - REF_NAME: ${{ gitea.ref_name }} - run: + - name: Fetch tags from main branch + # since this workflow is triggered by a pull request, we want to match the latest tag of the main branch + id: build_name + run: | + git fetch origin main --tags + LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) # remove the 'v' prefix from the tag name - echo "BUILD_NAME=${REF_NAME//v}" >> $GITHUB_ENV + echo "BUILD_NAME=${LATEST_TAG//v}" >> $GITHUB_OUTPUT - name: Setup SSH key for match git repo # and mark the host as known @@ -63,7 +64,7 @@ jobs: run: bundle exec fastlane deploy_beta env: BUILD_NUMBER: ${{ gitea.run_number }} - # BUILD_NAME is implicitly available + BUILD_NAME: ${{ steps.build_name.outputs.BUILD_NAME }} 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 }}