[BITAU-171] Fix SPM Package file to expose the correct name - Authent… #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI - main | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
build-version: | |
description: "Optional. Version string to use, in X.Y.Z format. Overrides default in the project." | |
required: false | |
type: string | |
build-number: | |
description: "Optional. Build number to use. Overrides default of GitHub run number." | |
required: false | |
type: number | |
env: | |
XCODE_VERSION: '15.4' | |
jobs: | |
resolve-values: | |
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 }} | |
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 | |
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 + 1000)) | |
fi | |
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 | |
build: | |
name: Build | |
needs: resolve-values | |
uses: ./.github/workflows/build.yml | |
strategy: | |
matrix: | |
variant: [Beta, Production] | |
with: | |
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 }} | |
secrets: inherit |