Skip to content

Commit

Permalink
Start from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentTreguier committed Jun 10, 2024
1 parent b7b2d9a commit defd9e9
Show file tree
Hide file tree
Showing 232 changed files with 1,275 additions and 12,364 deletions.
98 changes: 77 additions & 21 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ on:
jobs:
build:
name: Build
runs-on: macos-14
runs-on: macos-latest
environment: apple-app-store
strategy:
matrix:
platform:
- iOS
- macOS
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -33,12 +38,15 @@ jobs:
- name: Set up signing certificate
env:
CERTIFICATE_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_PRIVATE_KEY_B64 }}
CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64 }}
run: |
echo $CERTIFICATE_PRIVATE_KEY_B64 | base64 --decode > /tmp/cert-fyreplace.p12
security create-keychain -p password build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p password build.keychain
security set-keychain-settings build.keychain
echo $CERTIFICATE_PRIVATE_KEY_B64 | base64 --decode > /tmp/cert-fyreplace.p12
security import /tmp/cert-fyreplace.p12 -k build.keychain -P '' -T /usr/bin/codesign
echo $CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64 | base64 --decode > /tmp/cert-fyreplace.p12
security import /tmp/cert-fyreplace.p12 -k build.keychain -P '' -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k password build.keychain
Expand All @@ -50,70 +58,118 @@ jobs:
- name: Prepare files
run: make

- name: Install dependencies
- name: Test app
if: ${{ matrix.platform == 'iOS' }}
run: |
xcodebuild test \
-scheme Fyreplace \
-destination 'platform=${{ matrix.platform }} Simulator,name=${{ vars.IOS_SIMULATOR }}'
xcrun simctl shutdown all
- name: Test app
if: ${{ matrix.platform == 'macOS' }}
run: |
brew install protobuf swift-protobuf grpc-swift
xcodebuild test \
DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \
-allowProvisioningUpdates \
-authenticationKeyPath /tmp/connect-key.p8 \
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \
-scheme Fyreplace \
-destination platform=${{ matrix.platform }}
- name: Build app
run: |
xcodebuild archive \
DEVELOPMENT_TEAM=${{ secrets.TEAM_ID }} \
PROVISIONING_PROFILE_SPECIFIER=${{ secrets.PROVISIONING_PROFILE_NAME }} \
DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \
-allowProvisioningUpdates \
-authenticationKeyPath /tmp/connect-key.p8 \
-authenticationKeyID ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }} \
-authenticationKeyIssuerID ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} \
-workspace Fyreplace.xcworkspace \
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \
-scheme Fyreplace \
-destination generic/platform=${{ matrix.platform }} \
-archivePath archive.xcarchive
- name: Export to IPA
if: ${{ matrix.platform == 'iOS' }}
run: |
/usr/libexec/PlistBuddy -c "Add :method string" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Set :method app-store" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Set :method app-store-connect" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :teamId string" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Set :teamId ${{ secrets.TEAM_ID }}" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Set :teamId ${{ vars.TEAM_ID }}" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles dict" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles:${{ secrets.APP_ID }} string ${{ secrets.PROVISIONING_PROFILE_NAME }}" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles:${{ vars.APP_ID }} string ${{ vars.PROVISIONING_PROFILE_NAME }}" ExportOptions.plist
xcodebuild export \
-allowProvisioningUpdates \
-authenticationKeyPath /tmp/connect-key.p8 \
-authenticationKeyID ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }} \
-authenticationKeyIssuerID ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} \
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \
-archivePath archive.xcarchive \
-exportArchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath export
- name: Export to PKG
if: ${{ matrix.platform == 'macOS' }}
run: |
xcrun productbuild \
--component archive.xcarchive/Products/Applications/Fyreplace.app \
/Applications \
export/Fyreplace.unsigned
xcrun productsign \
--sign ${{ vars.TEAM_ID }} \
export/Fyreplace.unsigned \
export/Fyreplace.pkg
- uses: actions/upload-artifact@v4
if: ${{ matrix.platform == 'iOS' }}
with:
name: Fyreplace.ipa
path: export/*.ipa
if-no-files-found: error

- uses: actions/upload-artifact@v4
if: ${{ matrix.platform == 'macOS' }}
with:
name: Fyreplace.pkg
path: export/*.pkg
if-no-files-found: error

publish:
name: Publish
needs: build
runs-on: macos-14
runs-on: macos-latest
environment: apple-app-store
strategy:
matrix:
platform:
- ios
- osx
steps:
- uses: actions/download-artifact@v4
if: ${{ matrix.platform == 'ios' }}
with:
name: Fyreplace.ipa
path: /tmp

- uses: actions/download-artifact@v4
if: ${{ matrix.platform == 'osx' }}
with:
name: Fyreplace.pkg
path: /tmp

- name: Set up App Store Connect authentication
env:
APP_STORE_CONNECT_PRIVATE_KEY_B64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_B64 }}
run: |
mkdir ~/private_keys
echo $APP_STORE_CONNECT_PRIVATE_KEY_B64 | base64 --decode > ~/private_keys/AuthKey_${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }}.p8
echo $APP_STORE_CONNECT_PRIVATE_KEY_B64 | base64 --decode > ~/private_keys/AuthKey_${{ vars.APP_STORE_CONNECT_KEY_ID }}.p8
- name: Upload IPA to App Store Connect
- name: Upload to App Store Connect
run: |
xcrun altool \
--upload-app \
--type ios \
--file /tmp/Fyreplace.ipa \
--apiKey ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }} \
--apiIssuer ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
--type ${{ matrix.platform }} \
--file /tmp/Fyreplace.* \
--apiKey ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
--apiIssuer ${{ vars.APP_STORE_CONNECT_ISSUER_ID }}
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
xcuserdata
build
archive.xcarchive
export
ExportOptions.plist
export
*.xcarchive
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions Config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Config.xcconfig
33 changes: 33 additions & 0 deletions Config/Config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

branch=$(git rev-parse --abbrev-ref HEAD)
commit_count=$(git rev-list --count HEAD)
version=$(git describe --tags)
version_string=$(echo $version | sed -E 's/^v([0-9]+.[0-9]+.[0-9]+)(-.+)?/\1/')

case $version in
*-*)
version_number_suffix=0
IFS='.' read -r major minor patch <<< $version_string
minor=$((minor + 1))
version_string="$major.$minor.$patch"
;;
*)
version_number_suffix=3
;;
esac

case $branch in
hotfix/*)
version_number_suffix=2
version_string=${branch/"hotfix/"/}
;;
release/*)
version_number_suffix=1
version_string=${branch/"release/"/}
;;
esac

script_dir=$(dirname $0)
echo "VERSION_NUMBER=$commit_count.$version_number_suffix" > $script_dir/Config.xcconfig
echo "VERSION_STRING=$version_string" >> $script_dir/Config.xcconfig
Loading

0 comments on commit defd9e9

Please sign in to comment.