diff --git a/.github/actions/ios/build/action.yml b/.github/actions/ios/build/action.yml index 347ac549..470f688f 100644 --- a/.github/actions/ios/build/action.yml +++ b/.github/actions/ios/build/action.yml @@ -2,6 +2,22 @@ name: ios build description: build ios package inputs: + workingDirectory: + description: xcodebuild directory + required: false + default: '' + infoPlistPath: + description: Path to Info.plist to get application version + required: false + default: 'Info.plist' + githubUsername: + description: GitHub username for access to github-packages + required: false + default: '' + githubToken: + description: GitHub token for access to github-packages + required: false + default: '' archivePath: description: string required: true @@ -30,33 +46,55 @@ inputs: runs: using: composite steps: + - name: Get versions + id: get-version + shell: bash + run: | + CURRENT_PROJECT_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${{ github.workspace }}/${{ inputs.infoPlistPath }}") + MARKETING_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${{ github.workspace }}/${{ inputs.infoPlistPath }}") + + echo "Current project version: $CURRENT_PROJECT_VERSION" + echo "Current marketing version: $MARKETING_VERSION" + + echo "currentProjectVersion=$CURRENT_PROJECT_VERSION" >> "$GITHUB_OUTPUT" + echo "marketingVersion=$MARKETING_VERSION" >> "$GITHUB_OUTPUT" + - name: Build and Archive shell: bash + working-directory: ${{ inputs.workingDirectory | github.workspace }} env: API_KEY_ID: ${{ inputs.appStoreConnectApiKeyId }} ISSUER_ID: ${{ inputs.appStoreConnectIssuerId }} ARCHIVE_PATH: ${{ inputs.archivePath }} + GITHUB_USERNAME: ${{ inputs.githubUsername }} + GITHUB_TOKEN: ${{ inputs.githubToken }} run: | - CURRENT_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${{ github.workspace }}/Info.plist") - MARKETING_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${{ github.workspace }}/Info.plist") - - echo "Current version: $CURRENT_VERSION" - echo "Current marketing version: $MARKETING_VERSION" - - xcrun xcodebuild \ - -workspace "${{ inputs.xcworkspace }}" \ - -scheme "${{ inputs.scheme }}" \ - -configuration AppStoreDistribution \ + TEAM_ID_ENV=MYA32EHWN4 \ + BUNDLE_ID_ENV=com.rees46.loyalty-program \ + APP_NAME_ENV="REES46 Loyalty Program" \ + PROVISIONING_PROFILE_SPECIFIER_ENV="loyalty distribution" \ + xcodebuild \ + -project iosApp.xcodeproj \ + -scheme iosApp \ + -configuration Release \ -sdk iphoneos \ - -parallelizeTargets \ - -showBuildTimingSummary \ - -disableAutomaticPackageResolution \ - -archivePath "$ARCHIVE_PATH" \ - archive \ - CODE_SIGN_STYLE=Manual \ - CURRENT_PROJECT_VERSION="$CURRENT_VERSION" \ - MARKETING_VERSION="$MARKETING_VERSION" \ - CODE_SIGN_IDENTITY="${{ inputs.codeSignIdentity }}" \ - DEVELOPMENT_TEAM="${{ inputs.developmentTeam }}" \ - PROVISIONING_PROFILE_SPECIFIER="${{ inputs.provisioningProfileSpecifier }}" \ - OTHER_CODE_SIGN_FLAGS="--deep" + clean build + + # TODO uncomment + # xcrun xcodebuild \ + # -workspace "${{ inputs.xcworkspace }}" \ + # -scheme "${{ inputs.scheme }}" \ + # -configuration AppStoreDistribution \ + # -sdk iphoneos \ + # -parallelizeTargets \ + # -showBuildTimingSummary \ + # -disableAutomaticPackageResolution \ + # -archivePath "$ARCHIVE_PATH" \ + # archive \ + # CODE_SIGN_STYLE=Manual \ + # CURRENT_PROJECT_VERSION="${{ steps.get-version.outputs.currentProjectVersion }}" \ + # MARKETING_VERSION="${{ steps.get-version.outputs.marketingVersion }}" \ + # CODE_SIGN_IDENTITY="${{ inputs.codeSignIdentity }}" \ + # DEVELOPMENT_TEAM="${{ inputs.developmentTeam }}" \ + # PROVISIONING_PROFILE_SPECIFIER="${{ inputs.provisioningProfileSpecifier }}" \ + # OTHER_CODE_SIGN_FLAGS="--deep" diff --git a/.github/actions/ios/prepare-publish/action.yml b/.github/actions/ios/prepare-publish/action.yml index 30aa63d1..24c10526 100644 --- a/.github/actions/ios/prepare-publish/action.yml +++ b/.github/actions/ios/prepare-publish/action.yml @@ -69,6 +69,7 @@ runs: with: xcode-version: 16 - - name: Pod install - shell: bash - run: pod install + # TODO ? + # - name: Pod install + # shell: bash + # run: pod install diff --git a/.github/actions/publish/prepare-testflight/action.yml b/.github/actions/ios/prepare-testflight/action.yml similarity index 100% rename from .github/actions/publish/prepare-testflight/action.yml rename to .github/actions/ios/prepare-testflight/action.yml diff --git a/.github/actions/publish/publish-testflight/action.yml b/.github/actions/ios/publish-testflight/action.yml similarity index 100% rename from .github/actions/publish/publish-testflight/action.yml rename to .github/actions/ios/publish-testflight/action.yml diff --git a/.github/workflows/reusable-ios-testflight-publish.yaml b/.github/workflows/reusable-ios-testflight-publish.yaml index f6881c93..b992e5b1 100644 --- a/.github/workflows/reusable-ios-testflight-publish.yaml +++ b/.github/workflows/reusable-ios-testflight-publish.yaml @@ -11,6 +11,15 @@ env: on: workflow_call: inputs: + workingDirectory: + description: xcodebuild execution directory + required: false + type: string + infoPlistPath: + description: Path to Info.plist to get application version + required: false + type: string + default: 'Info.plist' xcworkspace: required: true type: string @@ -26,6 +35,15 @@ on: provisioningProfileSpecifier: required: true type: string + shopId: + required: false + type: string + shopSecret: + required: false + type: string + baseUrl: + required: false + type: string secrets: GITHUB_APP_ID: required: true @@ -57,12 +75,21 @@ jobs: steps: - name: Prepare testflight - uses: rees46/workflow/.github/actions/publish/prepare-testflight@master + uses: rees46/workflow/.github/actions/ios/prepare-testflight@master with: secretsJson: ${{ toJSON(secrets) }} + - name: Set loyalty-program envs + if: ${{ inputs.shopId && iputs.shopSecret && inputs.baseUrl }} + run: | + echo "SHOP_ID=${{ inputs.shopId }}" >> "$GITHUB_ENV" + echo "SHOP_SECRET=${{ inputs.shopSecret }}" >> "$GITHUB_ENV" + echo "BASE_URL=${{ inputs.baseUrl }}" >> "$GITHUB_ENV" + - name: Prepare ios enveronment - uses: rees46/workflow/.github/actions/ios/prepare-publish@master + # TODO rm + # uses: rees46/workflow/.github/actions/ios/prepare-publish@master + uses: rees46/workflow/.github/actions/ios/prepare-publish@refactor/publish-ios-workflow with: iosCertificateP12Base64: ${{ secrets.IOS_CERTIFICATE_P12 }} p12Password: ${{ secrets.IOS_CERTIFICATE_PASSWORD }} @@ -72,8 +99,14 @@ jobs: appStoreConnectApiKey: ${{ secrets.APP_STORE_CONNECT_API_KEY }} - name: Build ios - uses: rees46/workflow/.github/actions/ios/build@master + # TODO rm + # uses: rees46/workflow/.github/actions/ios/build@master + uses: rees46/workflow/.github/actions/ios/build@refactor/publish-ios-workflow with: + workingDirectory: ${{ inputs.workingDirectory }} + infoPlistPath: ${{ input.infoPlistPath }} + githubUsername: jade-smith-rs46 + githubToken: ${{ secrets.JADE_SMITH_BOT_TOKEN }} appStoreConnectApiKeyId: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} appStoreConnectIssuerId: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} archivePath: ${{ env.ARCHIVE_PATH }} @@ -91,7 +124,7 @@ jobs: archiveExportPath: ${{ env.ARCHIVE_EXPORT_PATH }} - name: Upload to testflight - uses: rees46/workflow/.github/actions/publish/publish-testflight@master + uses: rees46/workflow/.github/actions/ios/publish-testflight@master with: archiveExportPath: ${{ env.ARCHIVE_EXPORT_PATH }} appStoreConnectIssuerId: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}