Skip to content

Commit

Permalink
Merge pull request #16 from shilokuma-inc/chore/workflow
Browse files Browse the repository at this point in the history
【CHORE】 ワークフローを一般化するように修正
  • Loading branch information
mrs1669 authored May 14, 2024
2 parents 9438670 + eabddab commit 51cf02d
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 57 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/archive-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ jobs:
echo Using default scheme: $default
- name: Archive Project
run: |
xcodebuild archive -project IOSTemplateApp.xcodeproj \
-scheme IOSTemplateApp \
-sdk iphoneos \
-configuration Release \
-archivePath IOSTemplateApp.xcarchive \
CODE_SIGNING_ALLOWED=NO
run: |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
xcodebuild archive -"$filetype_parameter" "$file_to_build" \
-scheme $default \
-sdk iphoneos \
-configuration Release \
-archivePath build.xcarchive \
CODE_SIGNING_ALLOWED=NO
- name: Create ExportOptions.plist
run: |
Expand All @@ -45,7 +48,7 @@ jobs:
- name: Export IPA
run: |
xcodebuild -exportArchive \
-archivePath IOSTemplateApp.xcarchive \
-archivePath build.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath app.ipa \
-allowProvisioningUpdates \
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/archive-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ jobs:
echo Using default scheme: $default
- name: Archive Project
run: |
xcodebuild archive -project IOSTemplateApp.xcodeproj \
-scheme IOSTemplateApp \
-sdk iphoneos \
-configuration Release \
-archivePath IOSTemplateApp.xcarchive \
CODE_SIGNING_ALLOWED=NO
run: |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
xcodebuild archive -"$filetype_parameter" "$file_to_build" \
-scheme $default \
-sdk iphoneos \
-configuration Release \
-archivePath build.xcarchive \
CODE_SIGNING_ALLOWED=NO
- name: Create ExportOptions.plist
run: |
Expand All @@ -45,7 +48,7 @@ jobs:
- name: Export IPA
run: |
xcodebuild -exportArchive \
-archivePath IOSTemplateApp.xcarchive \
-archivePath build.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath app.ipa \
-allowProvisioningUpdates \
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/archive-working.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ jobs:
- name: Set Default Scheme
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
echo "$scheme_list"
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
- name: Archive Project
run: |
xcodebuild archive -project IOSTemplateApp.xcodeproj \
-scheme IOSTemplateApp \
run: |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
xcodebuild archive -"$filetype_parameter" "$file_to_build" \
-scheme $default \
-sdk iphoneos \
-configuration Release \
-archivePath IOSTemplateApp.xcarchive \
-archivePath build.xcarchive \
CODE_SIGNING_ALLOWED=NO
- name: Create ExportOptions.plist
Expand All @@ -48,7 +52,7 @@ jobs:
- name: Export IPA
run: |
xcodebuild -exportArchive \
-archivePath IOSTemplateApp.xcarchive \
-archivePath build.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath app.ipa \
-allowProvisioningUpdates \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-working.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:

- name: Set Default Scheme
run: |
xcodebuild -resolvePackageDependencies -project IOSTemplateApp.xcodeproj -scheme IOSTemplateApp
scheme_list=$(xcodebuild -list -json)
echo "$scheme_list"
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
Expand Down
38 changes: 22 additions & 16 deletions .github/workflows/release-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,27 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set Default Scheme
- name: Set Environment
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then app_name="`ls -A | grep -i \\.xcworkspace\$`"; else app_name="`ls -A | grep -i \\.xcodeproj\$`"; fi
if [[ "$app_name" == *.xcodeproj ]]; then
project_name="${app_name%.xcodeproj}"
elif [[ "$app_name" == *.xcworkspace ]]; then
project_name="${app_name%.xcworkspace}"
fi
echo "PROJECT_NAME=$project_name" >> $GITHUB_ENV
- name: Archive Project
run: |
xcodebuild archive -project IOSTemplateApp.xcodeproj \
-scheme IOSTemplateApp \
-sdk iphoneos \
-configuration Release \
-archivePath IOSTemplateApp.xcarchive \
CODE_SIGNING_ALLOWED=NO
run: |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
xcodebuild archive -"$filetype_parameter" "$file_to_build" \
-scheme $default \
-sdk iphoneos \
-configuration Release \
-archivePath build.xcarchive \
CODE_SIGNING_ALLOWED=NO
- name: Create ExportOptions.plist
run: |
Expand All @@ -45,7 +51,7 @@ jobs:
- name: Export IPA
run: |
xcodebuild -exportArchive \
-archivePath IOSTemplateApp.xcarchive \
-archivePath build.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath app.ipa \
-allowProvisioningUpdates \
Expand All @@ -55,13 +61,13 @@ jobs:
- name: Upload IPA file to App Store Connect
run: |
xcrun altool --upload-app -f app.ipa/IOSTemplateApp.ipa \
xcrun altool --upload-app -f app.ipa/${{ env.PROJECT_NAME }}.ipa \
-u ${{ secrets.APPLE_ID }} \
-p ${{ secrets.APP_SPECIFIC_PASSWORD }} \
--type ios
- name: Upload IPA file to GitHub
uses: actions/upload-artifact@v3
with:
name: IOSTemplateApp.ipa
path: app.ipa/IOSTemplateApp.ipa
name: ${{ env.PROJECT_NAME }}.ipa
path: app.ipa/${{ env.PROJECT_NAME }}.ipa
44 changes: 25 additions & 19 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,27 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set Default Scheme
- name: Set Environment
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then app_name="`ls -A | grep -i \\.xcworkspace\$`"; else app_name="`ls -A | grep -i \\.xcodeproj\$`"; fi
if [[ "$app_name" == *.xcodeproj ]]; then
project_name="${app_name%.xcodeproj}"
elif [[ "$app_name" == *.xcworkspace ]]; then
project_name="${app_name%.xcworkspace}"
fi
echo "PROJECT_NAME=$project_name" >> $GITHUB_ENV
- name: Archive Project
run: |
xcodebuild archive -project IOSTemplateApp.xcodeproj \
-scheme IOSTemplateApp \
-sdk iphoneos \
-configuration Release \
-archivePath IOSTemplateApp.xcarchive \
CODE_SIGNING_ALLOWED=NO
run: |
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
xcodebuild archive -"$filetype_parameter" "$file_to_build" \
-scheme $default \
-sdk iphoneos \
-configuration Release \
-archivePath build.xcarchive \
CODE_SIGNING_ALLOWED=NO
- name: Create ExportOptions.plist
run: |
Expand All @@ -45,7 +51,7 @@ jobs:
- name: Export IPA
run: |
xcodebuild -exportArchive \
-archivePath IOSTemplateApp.xcarchive \
-archivePath build.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath app.ipa \
-allowProvisioningUpdates \
Expand All @@ -55,13 +61,13 @@ jobs:
- name: Upload IPA file to App Store Connect
run: |
xcrun altool --upload-app -f app.ipa/IOSTemplateApp.ipa \
-u ${{ secrets.APPLE_ID }} \
-p ${{ secrets.APP_SPECIFIC_PASSWORD }} \
--type ios
xcrun altool --upload-app -f app.ipa/${{ env.PROJECT_NAME }}.ipa \
-u ${{ secrets.APPLE_ID }} \
-p ${{ secrets.APP_SPECIFIC_PASSWORD }} \
--type ios
- name: Upload IPA file to GitHub
uses: actions/upload-artifact@v3
with:
name: IOSTemplateApp.ipa
path: app.ipa/IOSTemplateApp.ipa
name: ${{ env.PROJECT_NAME }}.ipa
path: app.ipa/${{ env.PROJECT_NAME }}.ipa

0 comments on commit 51cf02d

Please sign in to comment.