Skip to content

Refactor/publish ios workflow #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 60 additions & 22 deletions .github/actions/ios/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
7 changes: 4 additions & 3 deletions .github/actions/ios/prepare-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
41 changes: 37 additions & 4 deletions .github/workflows/reusable-ios-testflight-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down