From d57f23d715478aeb880fc9d43f6077f9578f0798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 11 Sep 2024 00:04:18 +0100 Subject: [PATCH 01/39] Adds a version calculation workflow --- .github/workflows/_version.yml | 115 +++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/_version.yml diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml new file mode 100644 index 0000000000..e28753973e --- /dev/null +++ b/.github/workflows/_version.yml @@ -0,0 +1,115 @@ +--- +name: Calculate Version Name and Number + + +on: + workflow_dispatch: + inputs: + base_version_number: + description: "Base version number to use for version calculation" + type: number + default: 0 + version_name: + description: "Overrides version name calculation" + distinct_id: + description: "Unique ID for this dispatch, used by dispatch-and-download.yml" + skip_checkout: + description: "Skip checking out the repository" + type: boolean + repository_dispatch: + +env: + BASE_VERSION_NUMBER: ${{ inputs.base_version_number || 0 }} + +jobs: + calculate-version: + name: Calculate Version Name and Number + runs-on: ubuntu-latest + steps: + - name: Log inputs to job summary + run: | + echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```json' >> $GITHUB_STEP_SUMMARY + echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + + - name: echo distinct ID ${{ github.event.inputs.distinct_id }} + run: echo ${{ github.event.inputs.distinct_id }} + + - name: Checkout repository + if: ${{ !inputs.skip_checkout || false }} + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-depth: 0 + + - name: Calculate version name + id: calc-version-name + run: | + output() { + local version_name=$1 + echo "version_name=$version_name" >> $GITHUB_OUTPUT + } + + # override version name if provided + if [[ ! -z "${{ inputs.version_name }}" ]]; then + echo -e "\nApplying version override" + version_name=${{ inputs.version_name }} + echo "::warning::Override applied: $version_name" + output "$version_name" + exit 0 + fi + + current_year=$(date +%Y) + current_month=$(date +%-m) + + latest_tag_version=$(git tag --sort=committerdate --list | tail -1) + if [[ -z "$latest_tag_version" ]]; then + version_name="${current_year}.${current_month}.0" + echo "::warning::No tags found, did you checkout? Calculating version from current date: $version_name" + output "$version_name" + exit 0 + fi + + # Git tag was found, calculate version from latest tag + latest_version=${latest_tag_version:1} # remove 'v' from tag version + + latest_major_version=$(echo $latest_version | cut -d "." -f 1) + latest_minor_version=$(echo $latest_version | cut -d "." -f 2) + latest_patch_version=$(echo $latest_version | cut -d "." -f 3) + + + if [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then + version_name="${latest_major_version}.${latest_minor_version}.$(($latest_patch_version + 1))" + else + version_name="${current_year}.${current_month}.0" + fi + + output "$version_name" + + + - name: Calculate version number + id: calc-version-number + run: | + version_number=$(($GITHUB_RUN_NUMBER + ${{ env.BASE_VERSION_NUMBER }})) + echo "version_number=$version_number" >> $GITHUB_OUTPUT + + - name: Create version info JSON + run: | + json='{ + "version_number": "${{ steps.calc-version-number.outputs.version_number }}", + "version_name": "${{ steps.calc-version-name.outputs.version_name }}" + }' + echo "$json" > version_info.json + + echo "## version-info.json" >> $GITHUB_STEP_SUMMARY + echo '```json' >> $GITHUB_STEP_SUMMARY + echo "$json" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + + - name: Upload version info artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: version-info + path: version_info.json From 0eebb3fae78b2783bcbedccad4d882887a52d0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 11 Sep 2024 00:05:03 +0100 Subject: [PATCH 02/39] New workflow to dispatch, wait and download artifacts from another workflow --- .../dispatch-and-download/action.yml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/dispatch-and-download/action.yml diff --git a/.github/workflows/dispatch-and-download/action.yml b/.github/workflows/dispatch-and-download/action.yml new file mode 100644 index 0000000000..b881a9b183 --- /dev/null +++ b/.github/workflows/dispatch-and-download/action.yml @@ -0,0 +1,69 @@ +name: Dispatch Workflow and Download Artifacts +description: 'Dispatches a workflow, waits for completion, and downloads artifacts' +inputs: + token: + description: GitHub Personal Access Token for making API requests. + required: true + workflow: + description: The workflow to dispatch, can be a filename or ID + required: true + ref: + description: The branch or tag to dispatch the workflow on + default: 'main' + repo: + description: Repository of the action to dispatch. + default: ${{ github.repository }} + owner: + description: Owner of the given repository. + default: ${{ github.repository_owner }} + workflow_timeout_seconds: + description: Time until giving up waiting for the start of the workflow run. + default: 120 + workflow_inputs: + description: A flat JSON object, only supports strings, numbers, and booleans (as per workflow inputs API). + distinct_id: + description: Specify a static string to use instead of a random distinct ID. +runs: + using: "composite" + steps: + - name: Log inputs to job summary + run: | + echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```json' >> $GITHUB_STEP_SUMMARY + echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + + - name: Dispatch an action and get the run ID and URL + uses: codex-/return-dispatch@bcb9c46cb8ee849d5e6cca0ba9c8529d620ae006 # v1.15.0 + id: return_dispatch + with: + token: ${{ inputs.token }} + ref: ${{ inputs.ref }} + repo: ${{ inputs.repo }} + owner: ${{ inputs.owner }} + workflow: ${{ inputs.workflow }} + workflow_timeout_seconds: ${{ inputs.workflow_timeout_seconds }} + workflow_inputs: ${{ inputs.workflow_inputs }} + distinct_id: ${{ inputs.distinct_id }} + + - name: Use the output run ID and URL + shell: bash + run: | + echo ${{steps.return_dispatch.outputs.run_id}} + echo ${{steps.return_dispatch.outputs.run_url}} + + - name: Download all artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + id: download + with: + run-id: ${{steps.return_dispatch.outputs.run_id}} + github-token: ${{ inputs.token }} + + - name: Debug artifact download + shell: bash + run: | + echo "Run ID: ${{steps.return_dispatch.outputs.run_id}}" + echo "Artifacts path: ${{ steps.download.outputs.download-path }}" + ls -laR ${{ steps.download.outputs.download-path }} From c6c2288ab45c1ca42571d5155882a7336420f3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 11 Sep 2024 23:43:05 +0100 Subject: [PATCH 03/39] PR feedback: Removes unnecessary newline and capitalises step name --- .github/workflows/_version.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index e28753973e..7f07fe11f1 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -35,10 +35,10 @@ jobs: echo '```' >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - - name: echo distinct ID ${{ github.event.inputs.distinct_id }} + - name: Echo distinct ID ${{ github.event.inputs.distinct_id }} run: echo ${{ github.event.inputs.distinct_id }} - - name: Checkout repository + - name: Check out repository if: ${{ !inputs.skip_checkout || false }} uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -79,7 +79,6 @@ jobs: latest_minor_version=$(echo $latest_version | cut -d "." -f 2) latest_patch_version=$(echo $latest_version | cut -d "." -f 3) - if [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then version_name="${latest_major_version}.${latest_minor_version}.$(($latest_patch_version + 1))" else @@ -88,7 +87,6 @@ jobs: output "$version_name" - - name: Calculate version number id: calc-version-number run: | From c6cc731268846362f5f419c3decab3a2404563fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 15:54:22 +0100 Subject: [PATCH 04/39] Aligned workflow input descriptions --- .github/workflows/CI-main.yml | 6 ++--- .github/workflows/_version.yml | 5 ++-- .github/workflows/build.yml | 24 +++++++------------ .../dispatch-and-download/action.yml | 7 ------ 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 780bbce758..d24060ccda 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -7,12 +7,10 @@ on: workflow_dispatch: inputs: build-version: - description: "Optional. Version string to use, in X.Y.Z format. Overrides default in the project." - required: false + description: "Version Name Override - e.g. '2024.8.1'" type: string build-number: - description: "Optional. Build number to use. Overrides default of GitHub run number." - required: false + description: "Version Number Override - e.g. '1021'" type: number env: diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index 7f07fe11f1..d22c0adaa2 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -10,13 +10,14 @@ on: type: number default: 0 version_name: - description: "Overrides version name calculation" + description: "Version Name Override - e.g. '2024.8.1'" + version_number: + description: "Version Number Override - e.g. '1021'" distinct_id: description: "Unique ID for this dispatch, used by dispatch-and-download.yml" skip_checkout: description: "Skip checking out the repository" type: boolean - repository_dispatch: env: BASE_VERSION_NUMBER: ${{ inputs.base_version_number || 0 }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ed5f00cbe..f4a0a9e6bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,41 +4,35 @@ on: workflow_dispatch: inputs: build-variant: - description: "Which variant of the app to build" + description: "Build Variant" required: true + default: "Production" type: choice options: - Beta - Production build-version: - description: "Optional. Version string to use, in X.Y.Z format. Overrides default in the project." - required: false + description: "Version Name Override - e.g. '2024.8.1'" type: string build-number: - description: "Optional. Build number to use. Overrides default of GitHub run number." - required: false + description: "Version Number Override - e.g. '1021'" type: number xcode-version: - description: "Optional. Xcode version to use. Overrides default." - required: false + description: "Xcode Version Override - e.g. '15.2'" type: string workflow_call: inputs: build-variant: - description: "Which variant of the app to build" - required: false + description: "Build Variant" type: string build-version: - description: "Version string to use, in X.Y.Z format" - required: false + description: "Version Name Override - e.g. '2024.8.1'" type: string build-number: - description: "Build number to use" - required: false + description: "Version Number Override - e.g. '1021'" type: string xcode-version: - description: "Xcode version to use" - required: false + description: "Xcode Version Override - e.g. '15.2'" type: string env: diff --git a/.github/workflows/dispatch-and-download/action.yml b/.github/workflows/dispatch-and-download/action.yml index b881a9b183..1555af3604 100644 --- a/.github/workflows/dispatch-and-download/action.yml +++ b/.github/workflows/dispatch-and-download/action.yml @@ -60,10 +60,3 @@ runs: with: run-id: ${{steps.return_dispatch.outputs.run_id}} github-token: ${{ inputs.token }} - - - name: Debug artifact download - shell: bash - run: | - echo "Run ID: ${{steps.return_dispatch.outputs.run_id}}" - echo "Artifacts path: ${{ steps.download.outputs.download-path }}" - ls -laR ${{ steps.download.outputs.download-path }} From 3ac6e45084e03cfe8a78d9fe64f8a16334443887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 18:00:15 +0100 Subject: [PATCH 05/39] Add version number override --- .github/workflows/_version.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index d22c0adaa2..f6d8e5c142 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -91,6 +91,14 @@ jobs: - name: Calculate version number id: calc-version-number run: | + # override version number if provided + if [[ ! -z "${{ inputs.version_number }}" ]]; then + version_number=${{ inputs.version_number }} + echo "::warning::Override applied: $version_number" + echo "version_number=$version_number" >> $GITHUB_OUTPUT + exit 0 + fi + version_number=$(($GITHUB_RUN_NUMBER + ${{ env.BASE_VERSION_NUMBER }})) echo "version_number=$version_number" >> $GITHUB_OUTPUT From d9fabb5e812cbdd2bea3b54544c0e8bb7cc56363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 18:05:45 +0100 Subject: [PATCH 06/39] Add patch version override --- .github/workflows/_version.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index f6d8e5c142..3def1b5e56 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -13,6 +13,8 @@ on: description: "Version Name Override - e.g. '2024.8.1'" version_number: description: "Version Number Override - e.g. '1021'" + patch_version: + description: "Patch Version Override - e.g. '999'" distinct_id: description: "Unique ID for this dispatch, used by dispatch-and-download.yml" skip_checkout: @@ -55,7 +57,6 @@ jobs: # override version name if provided if [[ ! -z "${{ inputs.version_name }}" ]]; then - echo -e "\nApplying version override" version_name=${{ inputs.version_name }} echo "::warning::Override applied: $version_name" output "$version_name" @@ -67,7 +68,7 @@ jobs: latest_tag_version=$(git tag --sort=committerdate --list | tail -1) if [[ -z "$latest_tag_version" ]]; then - version_name="${current_year}.${current_month}.0" + version_name="${current_year}.${current_month}.${{ inputs.patch_version || 0 }}" echo "::warning::No tags found, did you checkout? Calculating version from current date: $version_name" output "$version_name" exit 0 @@ -78,14 +79,16 @@ jobs: latest_major_version=$(echo $latest_version | cut -d "." -f 1) latest_minor_version=$(echo $latest_version | cut -d "." -f 2) - latest_patch_version=$(echo $latest_version | cut -d "." -f 3) - - if [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then - version_name="${latest_major_version}.${latest_minor_version}.$(($latest_patch_version + 1))" - else - version_name="${current_year}.${current_month}.0" + patch_version=0 + if [[ ! -z "${{ inputs.version_name }}" ]]; then + patch_version=${{ inputs.patch_version }} + echo "::warning::Patch Version Override applied: $patch_version" + elif [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then + latest_patch_version=$(echo $latest_version | cut -d "." -f 3) + patch_version=$(($latest_patch_version + 1)) fi + version_name="${current_year}.${current_month}.${patch_version}" output "$version_name" - name: Calculate version number From 72b302d1991f9e8a24035bbd50699f8c5321f7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 18:26:59 +0100 Subject: [PATCH 07/39] Use version-name in build.yml --- .github/workflows/build.yml | 84 ++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4a0a9e6bc..f9950d62c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,13 @@ on: xcode-version: description: "Xcode Version Override - e.g. '15.2'" type: string + base_version_number: + description: "Base version number to use for version calculation" + type: number + default: 2000 + patch_version: + description: "Patch Version Override - e.g. '999'" + type: string workflow_call: inputs: build-variant: @@ -34,7 +41,13 @@ on: xcode-version: description: "Xcode Version Override - e.g. '15.2'" type: string - + base_version_number: + description: "Base version number to use for version calculation" + type: number + default: 2000 + patch_version: + description: "Patch Version Override - e.g. '999'" + type: string env: BUILD_VARIANT: ${{ inputs.build-variant || 'Beta' }} XCODE_VERSION: ${{ inputs.xcode-version || '15.4' }} @@ -54,55 +67,32 @@ jobs: fetch-depth: 0 filter: tree:0 - - name: Calculate build version and number - id: calculate + - name: Calculate version + if: ${{ !inputs.build-version && !inputs.build-number }} + uses: bitwarden/ios/.github/actions/dispatch-and-download@main + id: dispatch-version + with: + token: ${{ secrets.GITHUB_TOKEN }} + repo: ios + owner: bitwarden + workflow: _version.yml + workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_number": "${{ inputs.patch_number }}"}' + - name: Read version info + id: version_info run: | - if [[ ! -z "${{ inputs.build-version }}" ]]; then - echo -e "\nApplying build version override" - next_version=${{ inputs.build-version }} - else - echo -e "\nCalculating next version..." - current_year=$(date +%Y) - current_month=$(date +%-m) - - latest_tag_version=$(git tag --sort=committerdate --list | tail -1) - latest_version=${latest_tag_version:1} # remove 'v' from tag version - - latest_major_version=$(echo $latest_version | cut -d "." -f 1) - latest_minor_version=$(echo $latest_version | cut -d "." -f 2) - latest_patch_version=$(echo $latest_version | cut -d "." -f 3) - - echo " Current Year: $current_year" - echo " Current Month: $current_month" - echo " Latest Version: $latest_version" - echo " Latest Major Version: $latest_major_version" - echo " Latest Minor Version: $latest_minor_version" - echo " Latest Patch Version: $latest_patch_version" - - if [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then - next_version="${latest_major_version}.${latest_minor_version}.$(($latest_patch_version + 1))" - else - next_version="${current_year}.${current_month}.0" - fi - fi - - if [[ ! -z "${{ inputs.build-number }}" ]]; then - echo -e "\nApplying build number override" - next_number=${{ inputs.build-number }} - else - echo -e "\nCalculating build number..." - next_number=$(($GITHUB_RUN_NUMBER)) - fi - - echo -e "\n" - echo "version=$next_version" >> $GITHUB_OUTPUT - echo "build_number=$next_number" >> $GITHUB_OUTPUT - + content=$(cat version-info/version_info.json) + echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT + echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT + - name: Upload version info artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: version-info + path: version-info/version_info.json - name: Print values run: | echo "**Variant**: ${{ env.BUILD_VARIANT }}" | tee -a $GITHUB_STEP_SUMMARY - echo "**Version**: ${{ steps.calculate.outputs.version }}" | tee -a $GITHUB_STEP_SUMMARY - echo "**Number**: ${{ steps.calculate.outputs.build_number }}" | tee -a $GITHUB_STEP_SUMMARY + echo "**Version**: ${{ steps.version_info.outputs.version_name }}" | tee -a $GITHUB_STEP_SUMMARY + echo "**Number**: ${{ steps.version_info.outputs.version_number }}" | tee -a $GITHUB_STEP_SUMMARY echo "**Xcode**: ${{ env.XCODE_VERSION }}" | tee -a $GITHUB_STEP_SUMMARY - name: Set Xcode version @@ -325,7 +315,7 @@ jobs: name: Bitwarden iOS ${{ steps.calculate.outputs.version }} (${{ steps.calculate.outputs.build_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION }} path: export if-no-files-found: error - + - name: Set up private auth key run: | mkdir ~/private_keys From c00992d975ed9f0e973865b300a5d9b6b54b806c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 20:46:34 +0100 Subject: [PATCH 08/39] Output inputs --- .github/workflows/_version.yml | 2 +- .github/workflows/build.yml | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index 3def1b5e56..821336325a 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: inputs: base_version_number: - description: "Base version number to use for version calculation" + description: "Base Version Number - Will be added to the calculated version number" type: number default: 0 version_name: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9950d62c7..71efaf3a33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ on: description: "Xcode Version Override - e.g. '15.2'" type: string base_version_number: - description: "Base version number to use for version calculation" + description: "Base Version Number - Will be added to the calculated version number" type: number default: 2000 patch_version: @@ -42,7 +42,7 @@ on: description: "Xcode Version Override - e.g. '15.2'" type: string base_version_number: - description: "Base version number to use for version calculation" + description: "Base Version Number - Will be added to the calculated version number" type: number default: 2000 patch_version: @@ -61,6 +61,15 @@ jobs: MINT_LINK_PATH: .mint/bin steps: + - name: Log inputs to job summary + run: | + echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```json' >> $GITHUB_STEP_SUMMARY + echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + - name: Check out repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -77,23 +86,19 @@ jobs: owner: bitwarden workflow: _version.yml workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_number": "${{ inputs.patch_number }}"}' + - name: Read version info id: version_info run: | content=$(cat version-info/version_info.json) echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT + - name: Upload version info artifact uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: version-info path: version-info/version_info.json - - name: Print values - run: | - echo "**Variant**: ${{ env.BUILD_VARIANT }}" | tee -a $GITHUB_STEP_SUMMARY - echo "**Version**: ${{ steps.version_info.outputs.version_name }}" | tee -a $GITHUB_STEP_SUMMARY - echo "**Number**: ${{ steps.version_info.outputs.version_number }}" | tee -a $GITHUB_STEP_SUMMARY - echo "**Xcode**: ${{ env.XCODE_VERSION }}" | tee -a $GITHUB_STEP_SUMMARY - name: Set Xcode version uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 From 31620ef73e6f142edc225506028bd00523509732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 21:22:42 +0100 Subject: [PATCH 09/39] Transitions CI-main to the new version-name --- .github/workflows/CI-main.yml | 87 ++++++++++++++++------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index d24060ccda..baa0a4a250 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -12,6 +12,9 @@ on: build-number: description: "Version Number Override - e.g. '1021'" type: number + patch_version: + description: "Patch Version Override - e.g. '999'" + type: string env: XCODE_VERSION: '15.4' @@ -24,61 +27,51 @@ jobs: build_variant: ${{ steps.calculate.outputs.variant }} build_version: ${{ steps.calculate.outputs.version }} build_number: ${{ steps.calculate.outputs.build_number }} - xcode_version: ${{ steps.calculate.outputs.xcode_version }} steps: - - name: Check out repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - fetch-depth: 0 - filter: tree:0 - - - name: Calculate build version and number - id: calculate + - name: Log inputs to job summary run: | - if [[ ! -z "${{ inputs.build-version }}" ]]; then - echo -e "\nApplying build version override" - next_version=${{ inputs.build-version }} - else - echo -e "\nCalculating next version..." - current_year=$(date +%Y) - current_month=$(date +%-m) - - latest_tag_version=$(git tag --sort=committerdate --list | tail -1) - latest_version=${latest_tag_version:1} # remove 'v' from tag version + echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```json' >> $GITHUB_STEP_SUMMARY + echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY - latest_major_version=$(echo $latest_version | cut -d "." -f 1) - latest_minor_version=$(echo $latest_version | cut -d "." -f 2) - latest_patch_version=$(echo $latest_version | cut -d "." -f 3) + - name: Calculate version + if: ${{ !inputs.build-version && !inputs.build-number }} + uses: bitwarden/ios/.github/actions/dispatch-and-download@main + id: dispatch-version + with: + token: ${{ secrets.GITHUB_TOKEN }} + repo: ios + owner: bitwarden + workflow: _version.yml + workflow_inputs: '{"base_version_number": "1000", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_number": "${{ inputs.patch_number }}"}' - echo " Current Year: $current_year" - echo " Current Month: $current_month" - echo " Latest Version: $latest_version" - echo " Latest Major Version: $latest_major_version" - echo " Latest Minor Version: $latest_minor_version" - echo " Latest Patch Version: $latest_patch_version" + - name: Read version info + id: version_info + run: | + # test if dispatch-version was skipped + if [ ! -f version-info/version_info.json ]; then + json='{ + "version_number": "${{ inputs.build-number }}", + "version_name": "${{ inputs.build-version }}" + }' - if [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then - next_version="${latest_major_version}.${latest_minor_version}.$(($latest_patch_version + 1))" - else - next_version="${current_year}.${current_month}.0" - fi + # file will be used by the upload step + echo "$json" > version-info/version_info.json fi - if [[ ! -z "${{ inputs.build-number }}" ]]; then - echo -e "\nApplying build number override" - next_number=${{ inputs.build-number }} - else - echo -e "\nCalculating build number..." - next_number=$(($GITHUB_RUN_NUMBER + 1000)) - fi + content=$(cat version-info/version_info.json) + echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT + echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT - echo -e "\n" - echo "**Version**: $next_version" | tee -a $GITHUB_STEP_SUMMARY - echo "**Build Number**: $next_number" | tee -a $GITHUB_STEP_SUMMARY - echo "version=$next_version" >> $GITHUB_OUTPUT - echo "build_number=$next_number" >> $GITHUB_OUTPUT - echo "xcode_version=$XCODE_VERSION" >> $GITHUB_OUTPUT + - name: Upload version info artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: version-info + path: version-info/version_info.json build: name: Build @@ -91,5 +84,5 @@ jobs: build-variant: ${{ matrix.variant }} build-version: ${{ needs.resolve-values.outputs.build_version }} build-number: ${{ needs.resolve-values.outputs.build_number }} - xcode-version: ${{ needs.resolve-values.outputs.xcode_version }} + xcode-version: ${{ env.XCODE_VERSION }} secrets: inherit From 08b996ea8ed5d3ba496e75d367ae6e0792647def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 21:25:00 +0100 Subject: [PATCH 10/39] Create the version-info.json file if the version calculation step was skipped --- .github/workflows/build.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71efaf3a33..2df4294b79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,6 +90,17 @@ jobs: - name: Read version info id: version_info run: | + # test if dispatch-version was skipped. In that case, creates the same .json file expected by the Upload artifact step + if [ ! -f version-info/version_info.json ]; then + json='{ + "version_number": "${{ inputs.build-number }}", + "version_name": "${{ inputs.build-version }}" + }' + + # file will be used by the upload step + echo "$json" > version-info/version_info.json + fi + content=$(cat version-info/version_info.json) echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT From 3a13fe78a3579119094ab2bb70634ae36622af0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 21:25:44 +0100 Subject: [PATCH 11/39] Updated comment --- .github/workflows/CI-main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index baa0a4a250..ba04b91f1a 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -52,14 +52,13 @@ jobs: - name: Read version info id: version_info run: | - # test if dispatch-version was skipped + # test if dispatch-version was skipped. In that case, creates the same .json file expected by the Upload artifact step if [ ! -f version-info/version_info.json ]; then json='{ "version_number": "${{ inputs.build-number }}", "version_name": "${{ inputs.build-version }}" }' - # file will be used by the upload step echo "$json" > version-info/version_info.json fi From e5f6406190e6d16a71ac61a4c0c37ce8b7e86f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 24 Sep 2024 21:56:45 +0100 Subject: [PATCH 12/39] Remove the need to checkout the repo --- .github/workflows/CI-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index ba04b91f1a..09d674ac72 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -75,7 +75,7 @@ jobs: build: name: Build needs: resolve-values - uses: ./.github/workflows/build.yml + uses: bitwarden/ios/.github/workflows/build.yml@main strategy: matrix: variant: [Beta, Production] From 1e187621becbd96e7f4105d601ce825626677ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 15:28:10 +0100 Subject: [PATCH 13/39] Dispatch action is in the wrong path, workaround it for now --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f06d0d4d3d..83afd9dfdd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,7 +84,7 @@ jobs: - name: Calculate version if: ${{ !inputs.build-version && !inputs.build-number }} - uses: bitwarden/ios/.github/actions/dispatch-and-download@main + uses: bitwarden/ios/.github/workflows/dispatch-and-download@main id: dispatch-version with: token: ${{ secrets.GITHUB_TOKEN }} From ba3622e6b0fa0fe76541a33dfe0684dbf21b8798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:32:04 +0100 Subject: [PATCH 14/39] Revert "Dispatch action is in the wrong path, workaround it for now" This reverts commit 1e187621becbd96e7f4105d601ce825626677ac9. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83afd9dfdd..f06d0d4d3d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,7 +84,7 @@ jobs: - name: Calculate version if: ${{ !inputs.build-version && !inputs.build-number }} - uses: bitwarden/ios/.github/workflows/dispatch-and-download@main + uses: bitwarden/ios/.github/actions/dispatch-and-download@main id: dispatch-version with: token: ${{ secrets.GITHUB_TOKEN }} From ccb4b8c360b487b2a28e6634a4df3f9c203762c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:39:35 +0100 Subject: [PATCH 15/39] temp: using branch dispatch instead of main --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f06d0d4d3d..f26793e553 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,7 +84,7 @@ jobs: - name: Calculate version if: ${{ !inputs.build-version && !inputs.build-number }} - uses: bitwarden/ios/.github/actions/dispatch-and-download@main + uses: bitwarden/ios/.github/actions/dispatch-and-download@use-version-name #TODO REVERT TO MAIN id: dispatch-version with: token: ${{ secrets.GITHUB_TOKEN }} From dd8513baa9195055264e4bd61060e163a0a00767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:43:37 +0100 Subject: [PATCH 16/39] Add shell to dispatch --- .github/actions/dispatch-and-download/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/dispatch-and-download/action.yml b/.github/actions/dispatch-and-download/action.yml index 1555af3604..7b5e11b0fd 100644 --- a/.github/actions/dispatch-and-download/action.yml +++ b/.github/actions/dispatch-and-download/action.yml @@ -27,6 +27,7 @@ runs: using: "composite" steps: - name: Log inputs to job summary + shell: bash run: | echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY From 073411c9d3c56af684b51fe37f05a0a1d5ea994e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:44:39 +0100 Subject: [PATCH 17/39] Update workflow inputs default values --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f26793e553..63201ed31d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: build-variant: description: "Build Variant" required: true - default: "Production" + default: "Beta" type: choice options: - Beta @@ -23,6 +23,7 @@ on: compiler-flags: description: "Compiler Flags - e.g. 'DEBUG_MENU FEATURE2'" type: string + default: "DEBUG_MENU" base_version_number: description: "Base Version Number - Will be added to the calculated version number" type: number From 5eea7a126e0f7d6c5b73040667994316913a9349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:47:34 +0100 Subject: [PATCH 18/39] Fix patch input name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63201ed31d..fc8dfb64fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,7 @@ jobs: repo: ios owner: bitwarden workflow: _version.yml - workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_number": "${{ inputs.patch_number }}"}' + workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_version": "${{ inputs.patch_number }}"}' - name: Read version info id: version_info From f18cd1a71072a8233fe96117b0a90bca37a8ffaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:55:13 +0100 Subject: [PATCH 19/39] Add debug logs --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc8dfb64fd..5156760de8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,6 +97,7 @@ jobs: - name: Read version info id: version_info run: | + ls -lAr #TODO remove this # test if dispatch-version was skipped. In that case, creates the same .json file expected by the Upload artifact step if [ ! -f version-info/version_info.json ]; then json='{ @@ -106,6 +107,8 @@ jobs: # file will be used by the upload step echo "$json" > version-info/version_info.json + + ls -lAr #TODO remove this fi content=$(cat version-info/version_info.json) From 55ebfef6dd08f005f242bc05a4fda51dbb0b383c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 17:55:41 +0100 Subject: [PATCH 20/39] Improve Inputs GitHub summary --- .github/actions/dispatch-and-download/action.yml | 2 +- .github/workflows/_version.yml | 2 +- .github/workflows/build.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/dispatch-and-download/action.yml b/.github/actions/dispatch-and-download/action.yml index 7b5e11b0fd..f0a652b4aa 100644 --- a/.github/actions/dispatch-and-download/action.yml +++ b/.github/actions/dispatch-and-download/action.yml @@ -29,7 +29,7 @@ runs: - name: Log inputs to job summary shell: bash run: | - echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "
Dispatch and Download Action Workflow Inputs" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```json' >> $GITHUB_STEP_SUMMARY echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index 821336325a..87811a4523 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Log inputs to job summary run: | - echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "
Version Workflow Inputs" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```json' >> $GITHUB_STEP_SUMMARY echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5156760de8..8a7232ee8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,7 +70,7 @@ jobs: steps: - name: Log inputs to job summary run: | - echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "
Build Workflow Inputs" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```json' >> $GITHUB_STEP_SUMMARY echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY From ef4ba2637daa07e23f6eede729c243939687bd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 18:21:38 +0100 Subject: [PATCH 21/39] Fix patch version input --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a7232ee8b..a119c95e08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,7 @@ jobs: repo: ios owner: bitwarden workflow: _version.yml - workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_version": "${{ inputs.patch_number }}"}' + workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_version": "${{ inputs.patch_version }}"}' - name: Read version info id: version_info From ca073099bc571888737b1b56cd17a08afa400055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 18:22:07 +0100 Subject: [PATCH 22/39] Directory needs to be created first --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a119c95e08..24154c1f95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,18 +97,17 @@ jobs: - name: Read version info id: version_info run: | - ls -lAr #TODO remove this # test if dispatch-version was skipped. In that case, creates the same .json file expected by the Upload artifact step if [ ! -f version-info/version_info.json ]; then + echo "::warning::version-version.json not found, was the previous step skipped? Creating a new file" json='{ "version_number": "${{ inputs.build-number }}", "version_name": "${{ inputs.build-version }}" }' # file will be used by the upload step + mkdir version-info echo "$json" > version-info/version_info.json - - ls -lAr #TODO remove this fi content=$(cat version-info/version_info.json) From bf760bc9d754f9ebe62b18cb7f7b01980a9a6a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 20:49:03 +0100 Subject: [PATCH 23/39] use branch version --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24154c1f95..a1b59a1ead 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,6 +91,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} repo: ios owner: bitwarden + ref: use-version-name #TODO REVERT TO MAIN workflow: _version.yml workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_version": "${{ inputs.patch_version }}"}' From 7198cca7ca21c7840d5f364e421e9a6715e8766a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 21:26:32 +0100 Subject: [PATCH 24/39] Change Version Number type to string --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1b59a1ead..91248bcffd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ on: type: string build-number: description: "Version Number Override - e.g. '1021'" - type: number + type: string xcode-version: description: "Xcode Version Override - e.g. '15.2'" type: string From 9e80635058692c885d67a546f12e9f844eaf8d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 21:36:33 +0100 Subject: [PATCH 25/39] Waiting for workflow to finish --- .../actions/dispatch-and-download/action.yml | 34 +++++++++++++++++++ .github/workflows/build.yml | 3 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/actions/dispatch-and-download/action.yml b/.github/actions/dispatch-and-download/action.yml index f0a652b4aa..63f83f360e 100644 --- a/.github/actions/dispatch-and-download/action.yml +++ b/.github/actions/dispatch-and-download/action.yml @@ -54,6 +54,40 @@ runs: run: | echo ${{steps.return_dispatch.outputs.run_id}} echo ${{steps.return_dispatch.outputs.run_url}} + - name: Wait for workflow to finish + shell: bash + run: | + sleep 5 + + timeout="30" # in seconds + interval="10" # in seconds + counter=0 + timeout_counter=0 + url="https://api.github.com/repos/${{ inputs.owner }}/${{ inputs.repo }}/actions/runs/${{steps.return_dispatch.outputs.run_id}}" + while true; do + run_data=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ inputs.token }}" $url) + status=$(echo "$run_data" | jq -r '.status') + + echo "Try -> $timeout_counter; status -> $status" + if [ "$status" = "completed" ]; then + conclusion=$(echo "$run_data" | jq -r '.conclusion') + if [ "$conclusion" != "success" ]; then + echo "::error::The workflow has not completed successfully." + exit 1 + else + echo "::notice::The workflow completed successfully!" + break + fi + fi + + timeout_counter=$((timeout_counter + 1)) + if [ $((timeout_counter * interval)) -ge $((timeout * 60)) ]; then + echo "::error::Timeout waiting for the workflow to complete." + exit 1 + fi + + sleep $interval + done - name: Download all artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91248bcffd..436854bc61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,12 +109,13 @@ jobs: # file will be used by the upload step mkdir version-info echo "$json" > version-info/version_info.json + else + echo "::notice::version-version.json found!" fi content=$(cat version-info/version_info.json) echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT - - name: Upload version info artifact uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: From 05bb44742d1cc77acbafa5655b2c1bd4ddb99c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Tue, 1 Oct 2024 23:26:28 +0100 Subject: [PATCH 26/39] fix patch version --- .github/workflows/_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index 87811a4523..255489f4fe 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -80,7 +80,7 @@ jobs: latest_major_version=$(echo $latest_version | cut -d "." -f 1) latest_minor_version=$(echo $latest_version | cut -d "." -f 2) patch_version=0 - if [[ ! -z "${{ inputs.version_name }}" ]]; then + if [[ ! -z "${{ inputs.patch_version }}" ]]; then patch_version=${{ inputs.patch_version }} echo "::warning::Patch Version Override applied: $patch_version" elif [[ "$current_year" == "$latest_major_version" && "$current_month" == "$latest_minor_version" ]]; then From 0988a2b011d5cd7db5d11e755ae1042b1e14f504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 00:04:04 +0100 Subject: [PATCH 27/39] Removing step skip for now --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 436854bc61..27141c98eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,7 +84,6 @@ jobs: filter: tree:0 - name: Calculate version - if: ${{ !inputs.build-version && !inputs.build-number }} uses: bitwarden/ios/.github/actions/dispatch-and-download@use-version-name #TODO REVERT TO MAIN id: dispatch-version with: From cbd5b807062baadbdff5cd122894cafd1bc74b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 00:04:31 +0100 Subject: [PATCH 28/39] Updated other steps to use the new version info --- .github/workflows/build.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27141c98eb..90dc74b886 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -308,12 +308,9 @@ jobs: ./Scripts/select_variant.sh ${{ env.BUILD_VARIANT }} "${{ inputs.compiler-flags }}" - name: Update build version and number - env: - build_version: ${{ steps.calculate.outputs.version }} - build_number: ${{ steps.calculate.outputs.build_number }} run: | - yq -i '.settings.MARKETING_VERSION = "${{ env.build_version }}"' 'project.yml' - yq -i '.settings.CURRENT_PROJECT_VERSION = "${{ env.build_number }}"' 'project.yml' + yq -i '.settings.MARKETING_VERSION = "${{ steps.version_info.outputs.version_name }}"' 'project.yml' + yq -i '.settings.CURRENT_PROJECT_VERSION = "${{ steps.version_info.outputs.version_number }}"' 'project.yml' - name: Update CI build info run: | @@ -332,7 +329,7 @@ jobs: - name: Upload IPA & dSYM files uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: - name: Bitwarden iOS ${{ steps.calculate.outputs.version }} (${{ steps.calculate.outputs.build_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION }} + name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION }} path: export if-no-files-found: error From 219de307aa8299638cdf36e50bde2794a557f1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 14:35:28 +0100 Subject: [PATCH 29/39] Reverted testing changes and improved comments --- .github/actions/dispatch-and-download/action.yml | 6 +++--- .github/workflows/build.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/dispatch-and-download/action.yml b/.github/actions/dispatch-and-download/action.yml index 63f83f360e..e89b4fe0df 100644 --- a/.github/actions/dispatch-and-download/action.yml +++ b/.github/actions/dispatch-and-download/action.yml @@ -72,17 +72,17 @@ runs: if [ "$status" = "completed" ]; then conclusion=$(echo "$run_data" | jq -r '.conclusion') if [ "$conclusion" != "success" ]; then - echo "::error::The workflow has not completed successfully." + echo "::error::Dispatched workflow failed." exit 1 else - echo "::notice::The workflow completed successfully!" + echo "::debug::Dispatched workflow completed successfully!" break fi fi timeout_counter=$((timeout_counter + 1)) if [ $((timeout_counter * interval)) -ge $((timeout * 60)) ]; then - echo "::error::Timeout waiting for the workflow to complete." + echo "::error::Timeout waiting for the Dispatched workflow to complete." exit 1 fi diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90dc74b886..5b323355b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,13 +84,13 @@ jobs: filter: tree:0 - name: Calculate version - uses: bitwarden/ios/.github/actions/dispatch-and-download@use-version-name #TODO REVERT TO MAIN + uses: bitwarden/ios/.github/actions/dispatch-and-download@main id: dispatch-version with: token: ${{ secrets.GITHUB_TOKEN }} - repo: ios owner: bitwarden - ref: use-version-name #TODO REVERT TO MAIN + repo: ios + ref: main workflow: _version.yml workflow_inputs: '{"base_version_number": "${{ inputs.base_version_number }}", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_version": "${{ inputs.patch_version }}"}' From 1f5be8447053e4fc5a8732d4638621d299c18247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:24:36 +0100 Subject: [PATCH 30/39] Fix inputs --- .github/workflows/CI-main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 09d674ac72..3459b4ab06 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Log inputs to job summary run: | - echo "
Workflow Inputs" >> $GITHUB_STEP_SUMMARY + echo "
CI-main Workflow Inputs" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo '```json' >> $GITHUB_STEP_SUMMARY echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY @@ -47,7 +47,7 @@ jobs: repo: ios owner: bitwarden workflow: _version.yml - workflow_inputs: '{"base_version_number": "1000", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_number": "${{ inputs.patch_number }}"}' + workflow_inputs: '{"base_version_number": "1000", "version_name": "${{ inputs.build-version }}", "version_number": "${{ inputs.build-number }}", "patch_version": "${{ inputs.patch_version }}"}' - name: Read version info id: version_info @@ -65,7 +65,6 @@ jobs: content=$(cat version-info/version_info.json) echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT - - name: Upload version info artifact uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: @@ -81,7 +80,7 @@ jobs: variant: [Beta, Production] with: build-variant: ${{ matrix.variant }} - build-version: ${{ needs.resolve-values.outputs.build_version }} - build-number: ${{ needs.resolve-values.outputs.build_number }} + build-version: ${{ needs.resolve-values.outputs.version_name }} + build-number: ${{ needs.resolve-values.outputs.version_number }} xcode-version: ${{ env.XCODE_VERSION }} secrets: inherit From abba86e974d0f94690c36a2a40ca10094a4bc0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:25:41 +0100 Subject: [PATCH 31/39] Fix Read version info --- .github/workflows/CI-main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 3459b4ab06..3618faedb3 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -54,12 +54,17 @@ jobs: run: | # test if dispatch-version was skipped. In that case, creates the same .json file expected by the Upload artifact step if [ ! -f version-info/version_info.json ]; then + echo "::warning::version-version.json not found, was the previous step skipped? Creating a new file" json='{ "version_number": "${{ inputs.build-number }}", "version_name": "${{ inputs.build-version }}" }' + # file will be used by the upload step + mkdir version-info echo "$json" > version-info/version_info.json + else + echo "::notice::version-version.json found!" fi content=$(cat version-info/version_info.json) From 1fa0328c9b47f458c4ad2f3246a6322671101c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:25:57 +0100 Subject: [PATCH 32/39] Testing input checks --- .github/workflows/CI-main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 3618faedb3..f3541aa136 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -29,6 +29,21 @@ jobs: build_number: ${{ steps.calculate.outputs.build_number }} steps: + - name: Test checks + run: | + echo "values build-number: ${{ inputs.build-number }}" + echo "values build-version: ${{ inputs.build-version }}" + + echo "!build-number: ${{ !inputs.build-number }}" + echo "!build-version: ${{ !inputs.build-version }}" + echo "build-number == \"\": ${{ inputs.build-number == "" }}" + echo "build-number == 0: ${{ inputs.build-number == 0 }}" + echo "build-version == \"\" ${{ inputs.build-version == "" }}" + + echo "!build: ${{ !inputs.build-number && !inputs.build-version }}" + echo "build aspas: ${{ inputs.build-number == "" && !inputs.build-version == "" }}" + exit 1 + - name: Log inputs to job summary run: | echo "
CI-main Workflow Inputs" >> $GITHUB_STEP_SUMMARY From f94de31c3b47c2a0e00da4c5b1935b084e852d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:32:15 +0100 Subject: [PATCH 33/39] Fix job output --- .github/workflows/CI-main.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index f3541aa136..6321120e2c 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -24,10 +24,8 @@ jobs: name: "Resolve values" runs-on: macos-14 outputs: - build_variant: ${{ steps.calculate.outputs.variant }} - build_version: ${{ steps.calculate.outputs.version }} - build_number: ${{ steps.calculate.outputs.build_number }} - + version_name: ${{ steps.version_info.outputs.version_name }} + version_number: ${{ steps.version_info.outputs.version_number }} steps: - name: Test checks run: | From cee6f4adf60a390b839e457c4a50847dac74d58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:33:27 +0100 Subject: [PATCH 34/39] fix "" --- .github/workflows/CI-main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 6321120e2c..3acc3a0032 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -34,12 +34,12 @@ jobs: echo "!build-number: ${{ !inputs.build-number }}" echo "!build-version: ${{ !inputs.build-version }}" - echo "build-number == \"\": ${{ inputs.build-number == "" }}" + echo "build-number == '': ${{ inputs.build-number == '' }}" echo "build-number == 0: ${{ inputs.build-number == 0 }}" - echo "build-version == \"\" ${{ inputs.build-version == "" }}" + echo "build-version == '' ${{ inputs.build-version == '' }}" echo "!build: ${{ !inputs.build-number && !inputs.build-version }}" - echo "build aspas: ${{ inputs.build-number == "" && !inputs.build-version == "" }}" + echo "build aspas: ${{ inputs.build-number == '' && !inputs.build-version == '' }}" exit 1 - name: Log inputs to job summary From c178d2feeb8463135e8d5cf816e9110f66e5c49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:37:42 +0100 Subject: [PATCH 35/39] fix environment var use --- .github/workflows/CI-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 3acc3a0032..7958b6dbda 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -100,5 +100,5 @@ jobs: build-variant: ${{ matrix.variant }} build-version: ${{ needs.resolve-values.outputs.version_name }} build-number: ${{ needs.resolve-values.outputs.version_number }} - xcode-version: ${{ env.XCODE_VERSION }} + xcode-version: $XCODE_VERSION secrets: inherit From a48819d71a4a7c3c1ebb8fdd79d9b43feb8f8001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 16:42:47 +0100 Subject: [PATCH 36/39] Add tests --- .github/workflows/CI-main.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 7958b6dbda..922bee8127 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -29,17 +29,13 @@ jobs: steps: - name: Test checks run: | + echo values echo "values build-number: ${{ inputs.build-number }}" echo "values build-version: ${{ inputs.build-version }}" - echo "!build-number: ${{ !inputs.build-number }}" - echo "!build-version: ${{ !inputs.build-version }}" - echo "build-number == '': ${{ inputs.build-number == '' }}" - echo "build-number == 0: ${{ inputs.build-number == 0 }}" - echo "build-version == '' ${{ inputs.build-version == '' }}" - echo "!build: ${{ !inputs.build-number && !inputs.build-version }}" - echo "build aspas: ${{ inputs.build-number == '' && !inputs.build-version == '' }}" + echo "build aspas: ${{ inputs.build-number == '' || inputs.build-version == '' }}" + exit 1 - name: Log inputs to job summary From 900a7694b91d62893b09945aaada9bc89e8a216b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 19:42:14 +0100 Subject: [PATCH 37/39] Fixed step check --- .github/workflows/CI-main.yml | 13 +------------ .github/workflows/build.yml | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 922bee8127..9560d05f12 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -27,17 +27,6 @@ jobs: version_name: ${{ steps.version_info.outputs.version_name }} version_number: ${{ steps.version_info.outputs.version_number }} steps: - - name: Test checks - run: | - echo values - echo "values build-number: ${{ inputs.build-number }}" - echo "values build-version: ${{ inputs.build-version }}" - - echo "!build: ${{ !inputs.build-number && !inputs.build-version }}" - echo "build aspas: ${{ inputs.build-number == '' || inputs.build-version == '' }}" - - exit 1 - - name: Log inputs to job summary run: | echo "
CI-main Workflow Inputs" >> $GITHUB_STEP_SUMMARY @@ -48,7 +37,7 @@ jobs: echo "
" >> $GITHUB_STEP_SUMMARY - name: Calculate version - if: ${{ !inputs.build-version && !inputs.build-number }} + if: ${{ inputs.build-number == '' || inputs.build-version == '' }} uses: bitwarden/ios/.github/actions/dispatch-and-download@main id: dispatch-version with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b323355b5..899b0cefd6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,7 @@ jobs: filter: tree:0 - name: Calculate version + if: ${{ inputs.build-number == '' || inputs.build-version == '' }} uses: bitwarden/ios/.github/actions/dispatch-and-download@main id: dispatch-version with: From 808b6b85ea84e5a9ac6d2f29b9ddb6941ec9723e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 22:00:07 +0100 Subject: [PATCH 38/39] Add the ability to skip distributing builds --- .github/workflows/CI-main.yml | 8 ++++++-- .github/workflows/build.yml | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 9560d05f12..5ed78e3863 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -15,10 +15,13 @@ on: patch_version: description: "Patch Version Override - e.g. '999'" type: string - + ditribute: + description: "Distribute to TestFlight" + type: boolean + default: false env: XCODE_VERSION: '15.4' - + DISTRIBUTE_TO_TESTFLIGHT: ${{ github.event_name == 'push' || inputs.distribute }} jobs: resolve-values: name: "Resolve values" @@ -86,4 +89,5 @@ jobs: build-version: ${{ needs.resolve-values.outputs.version_name }} build-number: ${{ needs.resolve-values.outputs.version_number }} xcode-version: $XCODE_VERSION + distribute: $DISTRIBUTE_TO_TESTFLIGHT secrets: inherit diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 899b0cefd6..47093fe607 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,10 @@ on: patch_version: description: "Patch Version Override - e.g. '999'" type: string + ditribute: + description: "Distribute to TestFlight" + type: boolean + default: false workflow_call: inputs: build-variant: @@ -55,6 +59,10 @@ on: patch_version: description: "Patch Version Override - e.g. '999'" type: string + ditribute: + description: "Distribute to TestFlight" + type: boolean + default: false env: BUILD_VARIANT: ${{ inputs.build-variant || 'Beta' }} XCODE_VERSION: ${{ inputs.xcode-version || '15.4' }} @@ -350,6 +358,7 @@ jobs: --apiIssuer "${{ secrets.APP_STORE_CONNECT_TEAM_ISSUER }}" - name: Upload app to TestFlight with Fastlane + if: ${{ inputs.ditribute }} run: | CHANGELOG="$(git show -s --format=%s) $GITHUB_REPOSITORY/$GITHUB_REF_NAME @ $GITHUB_SHA From b67c219d3c07fedeb3ee783dee3519678ab9894e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 2 Oct 2024 22:03:21 +0100 Subject: [PATCH 39/39] Adds Upload Version Info input to build and fixes input related issues --- .github/workflows/CI-main.yml | 12 +++++++----- .github/workflows/build.yml | 13 ++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI-main.yml b/.github/workflows/CI-main.yml index 5ed78e3863..6d31aaf9f9 100644 --- a/.github/workflows/CI-main.yml +++ b/.github/workflows/CI-main.yml @@ -15,20 +15,21 @@ on: patch_version: description: "Patch Version Override - e.g. '999'" type: string - ditribute: + distribute: description: "Distribute to TestFlight" type: boolean - default: false env: XCODE_VERSION: '15.4' DISTRIBUTE_TO_TESTFLIGHT: ${{ github.event_name == 'push' || inputs.distribute }} jobs: resolve-values: name: "Resolve values" - runs-on: macos-14 + runs-on: ubuntu-latest outputs: version_name: ${{ steps.version_info.outputs.version_name }} version_number: ${{ steps.version_info.outputs.version_number }} + xcode_version: ${{ env.XCODE_VERSION }} + distribute_to_testflight: ${{ env.DISTRIBUTE_TO_TESTFLIGHT }} steps: - name: Log inputs to job summary run: | @@ -88,6 +89,7 @@ jobs: build-variant: ${{ matrix.variant }} build-version: ${{ needs.resolve-values.outputs.version_name }} build-number: ${{ needs.resolve-values.outputs.version_number }} - xcode-version: $XCODE_VERSION - distribute: $DISTRIBUTE_TO_TESTFLIGHT + xcode-version: ${{ needs.resolve-values.outputs.xcode_version }} + distribute: ${{ fromJSON(needs.resolve-values.outputs.distribute_to_testflight) }} + upload_version_info: false secrets: inherit diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47093fe607..0880a0afa3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,10 +31,10 @@ on: patch_version: description: "Patch Version Override - e.g. '999'" type: string - ditribute: + distribute: description: "Distribute to TestFlight" type: boolean - default: false + default: true workflow_call: inputs: build-variant: @@ -59,10 +59,12 @@ on: patch_version: description: "Patch Version Override - e.g. '999'" type: string - ditribute: + distribute: description: "Distribute to TestFlight" type: boolean - default: false + upload_version_info: + description: "Upload version-info file - When false, caller may be handling it already" + type: boolean env: BUILD_VARIANT: ${{ inputs.build-variant || 'Beta' }} XCODE_VERSION: ${{ inputs.xcode-version || '15.4' }} @@ -125,6 +127,7 @@ jobs: echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT - name: Upload version info artifact + if: ${{ inputs.upload_version_info }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: version-info @@ -358,7 +361,7 @@ jobs: --apiIssuer "${{ secrets.APP_STORE_CONNECT_TEAM_ISSUER }}" - name: Upload app to TestFlight with Fastlane - if: ${{ inputs.ditribute }} + if: ${{ inputs.distribute }} run: | CHANGELOG="$(git show -s --format=%s) $GITHUB_REPOSITORY/$GITHUB_REF_NAME @ $GITHUB_SHA