mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-27 22:10:57 -04:00
commit
d415c9b767
2
.github/actions/xcbuild/action.yml
vendored
2
.github/actions/xcbuild/action.yml
vendored
@ -8,8 +8,6 @@ inputs:
|
|||||||
required: true
|
required: true
|
||||||
xc-destination:
|
xc-destination:
|
||||||
required: true
|
required: true
|
||||||
upload-to:
|
|
||||||
required: true
|
|
||||||
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE:
|
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE:
|
||||||
required: true
|
required: true
|
||||||
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD:
|
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD:
|
||||||
|
181
.github/workflows/cd.yml
vendored
181
.github/workflows/cd.yml
vendored
@ -13,117 +13,91 @@ env:
|
|||||||
KEYCHAIN_PROFILE: build-profile
|
KEYCHAIN_PROFILE: build-profile
|
||||||
SSH_KEY: /tmp/id_rsa
|
SSH_KEY: /tmp/id_rsa
|
||||||
APPLE_STORE_AUTH_KEY_PATH: /tmp/authkey.p8
|
APPLE_STORE_AUTH_KEY_PATH: /tmp/authkey.p8
|
||||||
|
APPLE_AUTH_PARAMS: "-authenticationKeyPath /tmp/authkey.p8 -authenticationKeyID ${{ secrets.APPLE_STORE_AUTH_KEY_ID }} -authenticationKeyIssuerID ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}"
|
||||||
|
# conditionally updated later:
|
||||||
|
EXPORT_METHOD: "app-store"
|
||||||
|
EXTRA_XCODEBUILD: ""
|
||||||
|
UPLOAD_TO: ""
|
||||||
|
VERSION: ""
|
||||||
|
SIGNING_CERTIFICATE: ""
|
||||||
|
SIGNING_CERTIFICATE_P12_PASSWORD: ""
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_deploy:
|
build_and_deploy:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
destination:
|
platform: [iOS, macOS]
|
||||||
- platform: macOS
|
uploadto: [app-store, ftp]
|
||||||
uploadto: dmg
|
|
||||||
- platform: macOS
|
|
||||||
uploadto: app-store
|
|
||||||
- platform: iOS
|
|
||||||
uploadto: ipa
|
|
||||||
xcode_extra: -sdk iphoneos
|
|
||||||
- platform: iOS
|
|
||||||
uploadto: app-store
|
|
||||||
xcode_extra: -sdk iphoneos
|
|
||||||
runs-on: macos-13
|
runs-on: macos-13
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set iOS extra xcode params
|
||||||
|
if: matrix.platform == 'iOS'
|
||||||
|
run: echo "EXTRA_XCODEBUILD=-sdk iphoneos ${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set macOS FTP export method
|
||||||
|
if: matrix.platform == 'macOS' && matrix.uploadto == 'ftp'
|
||||||
|
run: echo "EXPORT_METHOD=developer-id" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Decide whether building nightly or release
|
- name: Decide whether building nightly or release
|
||||||
env:
|
env:
|
||||||
PLATFORM: ${{ matrix.destination.platform }}
|
UPLOAD_TO: ${{ matrix.uploadto }}
|
||||||
UPLOAD_TO: ${{ matrix.destination.uploadto }}
|
|
||||||
EXTRA_XCODEBUILD: ${{ matrix.destination.xcode_extra }}
|
|
||||||
APPLE_STORE_AUTH_KEY_PATH: ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
|
||||||
APPLE_STORE_AUTH_KEY_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ID }}
|
|
||||||
APPLE_STORE_AUTH_KEY_ISSUER_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}
|
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
upload_to = os.getenv("UPLOAD_TO")
|
||||||
|
|
||||||
if os.getenv("GITHUB_EVENT_NAME", "") == "release":
|
if os.getenv("GITHUB_EVENT_NAME", "") == "release":
|
||||||
is_release = True
|
|
||||||
version = os.getenv("GITHUB_REF_NAME")
|
version = os.getenv("GITHUB_REF_NAME")
|
||||||
upload_folder = f"release/{version}"
|
upload_folder = f"release/{version}"
|
||||||
else:
|
else:
|
||||||
is_release = False
|
|
||||||
version = str(datetime.date.today())
|
version = str(datetime.date.today())
|
||||||
upload_folder = f"nightly/{version}"
|
upload_folder = f"nightly/{version}"
|
||||||
|
if upload_to == "app-store":
|
||||||
upload_to = os.getenv("UPLOAD_TO")
|
upload_to = "" # do not upload in this case
|
||||||
export_method = "developer-id" if upload_to == "dmg" else "app-store"
|
|
||||||
upload_to_apple = True
|
|
||||||
if not is_release and upload_to == "app-store":
|
|
||||||
upload_to_apple = False
|
|
||||||
|
|
||||||
extra_xcode = os.getenv("EXTRA_XCODEBUILD", "")
|
|
||||||
if os.getenv("PLATFORM") == "iOS":
|
|
||||||
extra_xcode += f" -authenticationKeyPath {os.getenv('APPLE_STORE_AUTH_KEY_PATH')}"
|
|
||||||
extra_xcode += f" -authenticationKeyID {os.getenv('APPLE_STORE_AUTH_KEY_ID')}"
|
|
||||||
extra_xcode += f" -authenticationKeyIssuerID {os.getenv('APPLE_STORE_AUTH_KEY_ISSUER_ID')}"
|
|
||||||
|
|
||||||
with open(os.getenv("GITHUB_ENV"), "a") as fh:
|
with open(os.getenv("GITHUB_ENV"), "a") as fh:
|
||||||
fh.write(f"VERSION={version}\n")
|
fh.write(f"VERSION={version}\n")
|
||||||
fh.write(f"ISRELEASE={'yes' if is_release else ''}\n")
|
|
||||||
fh.write(f"EXPORT_METHOD={export_method}\n")
|
|
||||||
fh.write(f"UPLOAD_FOLDER={upload_folder}\n")
|
fh.write(f"UPLOAD_FOLDER={upload_folder}\n")
|
||||||
fh.write(f"EXTRA_XCODEBUILD={extra_xcode}\n")
|
fh.write(f"UPLOAD_TO={upload_to}\n")
|
||||||
fh.write(f"UPLOAD_TO_APPLE={'yes' if upload_to_apple else ''}\n")
|
|
||||||
|
|
||||||
- name: Prepare use of Developper ID Certificate
|
- name: Use Developer ID Certificate
|
||||||
if: ${{ matrix.destination.uploadto == 'dmg' }}
|
if: env.UPLOAD_TO == 'ftp' && matrix.platform == 'macOS'
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
APPLE_DEVELOPER_ID_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPER_ID_SIGNING_CERTIFICATE }}
|
|
||||||
APPLE_DEVELOPER_ID_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_SIGNING_P12_PASSWORD }}
|
|
||||||
APPLE_DEVELOPER_ID_SIGNING_IDENTITY: ${{ secrets.APPLE_DEVELOPER_ID_SIGNING_IDENTITY }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "SIGNING_CERTIFICATE=${APPLE_DEVELOPER_ID_SIGNING_CERTIFICATE}" >> "$GITHUB_ENV"
|
echo "SIGNING_CERTIFICATE=${{ secrets.APPLE_DEVELOPER_ID_SIGNING_CERTIFICATE }}" >> $GITHUB_ENV
|
||||||
echo "SIGNING_CERTIFICATE_P12_PASSWORD=${APPLE_DEVELOPER_ID_SIGNING_P12_PASSWORD}" >> "$GITHUB_ENV"
|
echo "SIGNING_CERTIFICATE_P12_PASSWORD=${{ secrets.APPLE_DEVELOPER_ID_SIGNING_P12_PASSWORD }}" >> $GITHUB_ENV
|
||||||
echo "SIGNING_IDENTITY=${APPLE_DEVELOPER_ID_SIGNING_IDENTITY}" >> "$GITHUB_ENV"
|
echo "SIGNING_IDENTITY=${{ secrets.APPLE_DEVELOPER_ID_SIGNING_IDENTITY }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Prepare use of Apple Development Certificate
|
- name: Use Apple Development Certificate
|
||||||
if: ${{ matrix.destination.uploadto == 'ipa' }}
|
if: env.UPLOAD_TO == 'ftp' && matrix.platform == 'iOS'
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }}
|
|
||||||
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }}
|
|
||||||
APPLE_DEVELOPMENT_SIGNING_IDENTITY: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_IDENTITY }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "SIGNING_CERTIFICATE=${APPLE_DEVELOPMENT_SIGNING_CERTIFICATE}" >> "$GITHUB_ENV"
|
echo "SIGNING_CERTIFICATE=${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }}" >> $GITHUB_ENV
|
||||||
echo "SIGNING_CERTIFICATE_P12_PASSWORD=${APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD}" >> "$GITHUB_ENV"
|
echo "SIGNING_CERTIFICATE_P12_PASSWORD=${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }}" >> $GITHUB_ENV
|
||||||
echo "SIGNING_IDENTITY=${APPLE_DEVELOPMENT_SIGNING_IDENTITY}" >> "$GITHUB_ENV"
|
echo "SIGNING_IDENTITY=${{ secrets.APPLE_DEVELOPMENT_SIGNING_IDENTITY }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Prepare use of Apple Distribution Certificate
|
- name: Use Apple Distribution Certificate
|
||||||
if: ${{ matrix.destination.uploadto == 'app-store' }}
|
if: env.UPLOAD_TO == 'app-store'
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
APPLE_DISTRIBUTION_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DISTRIBUTION_SIGNING_CERTIFICATE }}
|
|
||||||
APPLE_DISTRIBUTION_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DISTRIBUTION_SIGNING_P12_PASSWORD }}
|
|
||||||
APPLE_DEVELOPMENT_SIGNING_IDENTITY: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_IDENTITY }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "SIGNING_CERTIFICATE=${APPLE_DISTRIBUTION_SIGNING_CERTIFICATE}" >> "$GITHUB_ENV"
|
echo "SIGNING_CERTIFICATE=${{ secrets.APPLE_DISTRIBUTION_SIGNING_CERTIFICATE }}" >> $GITHUB_ENV
|
||||||
echo "SIGNING_CERTIFICATE_P12_PASSWORD=${APPLE_DISTRIBUTION_SIGNING_P12_PASSWORD}" >> "$GITHUB_ENV"
|
echo "SIGNING_CERTIFICATE_P12_PASSWORD=${{ secrets.APPLE_DISTRIBUTION_SIGNING_P12_PASSWORD }}" >> $GITHUB_ENV
|
||||||
echo "SIGNING_IDENTITY=${APPLE_DEVELOPMENT_SIGNING_IDENTITY}" >> "$GITHUB_ENV"
|
echo "SIGNING_IDENTITY=${{ secrets.APPLE_DEVELOPMENT_SIGNING_IDENTITY }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Add Apple Store Key
|
- name: Decode Apple Store Key
|
||||||
env:
|
if: env.UPLOAD_TO != ''
|
||||||
APPLE_STORE_AUTH_KEY_PATH: ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
run: echo "${{ secrets.APPLE_STORE_AUTH_KEY }}" | base64 --decode -o ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
||||||
APPLE_STORE_AUTH_KEY: ${{ secrets.APPLE_STORE_AUTH_KEY }}
|
|
||||||
shell: bash
|
|
||||||
run: echo "${APPLE_STORE_AUTH_KEY}" | base64 --decode -o $APPLE_STORE_AUTH_KEY_PATH
|
|
||||||
|
|
||||||
- name: Build xcarchive
|
- name: Build xcarchive
|
||||||
uses: ./.github/actions/xcbuild
|
uses: ./.github/actions/xcbuild
|
||||||
|
if: env.UPLOAD_TO != ''
|
||||||
with:
|
with:
|
||||||
action: archive
|
action: archive
|
||||||
xc-destination: generic/platform=${{ matrix.destination.platform }}
|
xc-destination: generic/platform=${{ matrix.platform }}
|
||||||
upload-to: ${{ matrix.destination.uploadto }}
|
|
||||||
version: ${{ env.VERSION }}
|
version: ${{ env.VERSION }}
|
||||||
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }}
|
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }}
|
||||||
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }}
|
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }}
|
||||||
@ -135,7 +109,7 @@ jobs:
|
|||||||
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }}
|
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }}
|
||||||
|
|
||||||
- name: Add altool credentials to Keychain
|
- name: Add altool credentials to Keychain
|
||||||
shell: bash
|
if: env.UPLOAD_TO == 'ftp'
|
||||||
env:
|
env:
|
||||||
APPLE_SIGNING_ALTOOL_USERNAME: ${{ secrets.APPLE_SIGNING_ALTOOL_USERNAME }}
|
APPLE_SIGNING_ALTOOL_USERNAME: ${{ secrets.APPLE_SIGNING_ALTOOL_USERNAME }}
|
||||||
APPLE_SIGNING_ALTOOL_PASSWORD: ${{ secrets.APPLE_SIGNING_ALTOOL_PASSWORD }}
|
APPLE_SIGNING_ALTOOL_PASSWORD: ${{ secrets.APPLE_SIGNING_ALTOOL_PASSWORD }}
|
||||||
@ -151,64 +125,55 @@ jobs:
|
|||||||
--keychain $KEYCHAIN \
|
--keychain $KEYCHAIN \
|
||||||
$KEYCHAIN_PROFILE
|
$KEYCHAIN_PROFILE
|
||||||
|
|
||||||
- name: Prepare export for ${{ env.EXPORT_METHOD }}
|
|
||||||
if: ${{ matrix.destination.uploadto != 'ipa' }}
|
|
||||||
run: |
|
|
||||||
plutil -create xml1 ./export.plist
|
|
||||||
plutil -insert destination -string upload ./export.plist
|
|
||||||
plutil -insert method -string $EXPORT_METHOD ./export.plist
|
|
||||||
|
|
||||||
- name: Prepare export for IPA
|
- name: Prepare export for IPA
|
||||||
if: ${{ matrix.destination.uploadto == 'ipa' }}
|
if: matrix.platform == 'iOS' && env.UPLOAD_TO == 'ftp'
|
||||||
run: |
|
run: |
|
||||||
plutil -create xml1 ./export.plist
|
plutil -create xml1 ./export.plist
|
||||||
plutil -insert method -string ad-hoc ./export.plist
|
plutil -insert method -string ad-hoc ./export.plist
|
||||||
plutil -insert provisioningProfiles -dictionary ./export.plist
|
plutil -insert provisioningProfiles -dictionary ./export.plist
|
||||||
plutil -replace provisioningProfiles -json '{ "self.Kiwix" : "iOS Team Provisioning Profile" }' ./export.plist
|
plutil -replace provisioningProfiles -json '{ "self.Kiwix" : "iOS Team Provisioning Profile" }' ./export.plist
|
||||||
|
|
||||||
|
- name: Prepare export for ${{ matrix.uploadto }}
|
||||||
|
# else statement for Prepare export for IPA
|
||||||
|
# excluding UPLOAD_TO == '', which really means we should not upload
|
||||||
|
# [(macOS, ftp), (macOS, app-store), (iOS, app-store)]
|
||||||
|
if: matrix.platform != 'iOS' || env.UPLOAD_TO == 'app-store'
|
||||||
|
run: |
|
||||||
|
plutil -create xml1 ./export.plist
|
||||||
|
plutil -insert destination -string upload ./export.plist
|
||||||
|
plutil -insert method -string $EXPORT_METHOD ./export.plist
|
||||||
|
|
||||||
- name: Upload Archive to Apple (App Store or Notarization)
|
- name: Upload Archive to Apple (App Store or Notarization)
|
||||||
if: ${{ env.UPLOAD_TO_APPLE }}
|
if: env.UPLOAD_TO != ''
|
||||||
env:
|
env:
|
||||||
APPLE_STORE_AUTH_KEY_PATH: ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
VERSION: ${{ env.VERSION }}
|
||||||
APPLE_STORE_AUTH_KEY_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ID }}
|
run: python .github/retry-if-retcode.py --sleep 60 --attempts 5 --retcode 70 xcrun xcodebuild -exportArchive -archivePath $PWD/Kiwix-$VERSION.xcarchive -exportPath $PWD/export/ -exportOptionsPlist export.plist -allowProvisioningUpdates ${{ env.APPLE_AUTH_PARAMS }}
|
||||||
APPLE_STORE_AUTH_KEY_ISSUER_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}
|
|
||||||
run: python .github/retry-if-retcode.py --sleep 60 --attempts 5 --retcode 70 xcrun xcodebuild -exportArchive -archivePath $PWD/Kiwix-$VERSION.xcarchive -exportPath $PWD/export/ -exportOptionsPlist export.plist -authenticationKeyPath $APPLE_STORE_AUTH_KEY_PATH -allowProvisioningUpdates -authenticationKeyID $APPLE_STORE_AUTH_KEY_ID -authenticationKeyIssuerID $APPLE_STORE_AUTH_KEY_ISSUER_ID
|
|
||||||
|
|
||||||
- name: Export notarized App from archive
|
- name: Export notarized App from archive
|
||||||
if: ${{ matrix.destination.uploadto == 'dmg' }}
|
if: matrix.platform == 'macOS' && env.UPLOAD_TO == 'ftp'
|
||||||
env:
|
run: python .github/retry-if-retcode.py --sleep 60 --attempts 20 --retcode 65 xcrun xcodebuild -exportNotarizedApp -archivePath $PWD/Kiwix-$VERSION.xcarchive -exportPath $PWD/export/ -allowProvisioningUpdates ${{ env.APPLE_AUTH_PARAMS }}
|
||||||
APPLE_STORE_AUTH_KEY_PATH: ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
|
||||||
APPLE_STORE_AUTH_KEY_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ID }}
|
|
||||||
APPLE_STORE_AUTH_KEY_ISSUER_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}
|
|
||||||
run: python .github/retry-if-retcode.py --sleep 60 --attempts 20 --retcode 65 xcrun xcodebuild -exportNotarizedApp -archivePath $PWD/Kiwix-$VERSION.xcarchive -exportPath $PWD/export/ -authenticationKeyPath $APPLE_STORE_AUTH_KEY_PATH -allowProvisioningUpdates -authenticationKeyID $APPLE_STORE_AUTH_KEY_ID -authenticationKeyIssuerID $APPLE_STORE_AUTH_KEY_ISSUER_ID
|
|
||||||
|
|
||||||
- name: Create DMG
|
- name: Create and Notarize DMG
|
||||||
if: ${{ matrix.destination.uploadto == 'dmg' }}
|
if: matrix.platform == 'macOS' && env.UPLOAD_TO == 'ftp'
|
||||||
run: |
|
run: |
|
||||||
pip install dmgbuild
|
pip install dmgbuild
|
||||||
dmgbuild -s .github/dmg-settings.py -Dapp=$PWD/export/Kiwix.app -Dbg=.github/dmg-bg.png "Kiwix-$VERSION" $PWD/kiwix-$VERSION.dmg
|
dmgbuild -s .github/dmg-settings.py -Dapp=$PWD/export/Kiwix.app -Dbg=.github/dmg-bg.png "Kiwix-$VERSION" $PWD/kiwix-$VERSION.dmg
|
||||||
|
|
||||||
- name: Notarize DMG
|
|
||||||
if: ${{ matrix.destination.uploadto == 'dmg' }}
|
|
||||||
run: |
|
|
||||||
xcrun notarytool submit --keychain $KEYCHAIN --keychain-profile $KEYCHAIN_PROFILE --wait $PWD/kiwix-$VERSION.dmg
|
xcrun notarytool submit --keychain $KEYCHAIN --keychain-profile $KEYCHAIN_PROFILE --wait $PWD/kiwix-$VERSION.dmg
|
||||||
xcrun stapler staple $PWD/kiwix-$VERSION.dmg
|
xcrun stapler staple $PWD/kiwix-$VERSION.dmg
|
||||||
|
|
||||||
- name: Add SSH_KEY to filesystem
|
- name: Add SSH_KEY to filesystem
|
||||||
if: ${{ matrix.destination.uploadto == 'dmg' || matrix.destination.uploadto == 'ipa' }}
|
if: env.UPLOAD_TO == 'ftp'
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
PRIVATE_KEY: ${{ secrets.SSH_KEY }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "${PRIVATE_KEY}" > $SSH_KEY
|
echo "${{ secrets.SSH_KEY }}" > $SSH_KEY
|
||||||
chmod 600 $SSH_KEY
|
chmod 600 $SSH_KEY
|
||||||
|
|
||||||
- name: Upload DMG
|
- name: Upload DMG
|
||||||
if: ${{ matrix.destination.uploadto == 'dmg' }}
|
if: env.UPLOAD_TO == 'ftp' && matrix.platform == 'macOS'
|
||||||
run: python .github/upload_file.py --src ${PWD}/kiwix-${VERSION}.dmg --dest ci@master.download.kiwix.org:30022/data/download/${UPLOAD_FOLDER} --ssh-key ${SSH_KEY}
|
run: |
|
||||||
|
python .github/upload_file.py --src ${PWD}/kiwix-${VERSION}.dmg --dest ci@master.download.kiwix.org:30022/data/download/${UPLOAD_FOLDER} --ssh-key ${SSH_KEY}
|
||||||
|
|
||||||
- name: Upload IPA
|
- name: Upload IPA
|
||||||
if: ${{ matrix.destination.uploadto == 'ipa' }}
|
if: env.UPLOAD_TO == 'ftp' && matrix.platform == 'iOS'
|
||||||
run: |
|
run: |
|
||||||
mv ${PWD}/export/Kiwix.ipa ${PWD}/export/kiwix-${VERSION}.ipa
|
mv ${PWD}/export/Kiwix.ipa ${PWD}/export/kiwix-${VERSION}.ipa
|
||||||
python .github/upload_file.py --src ${PWD}/export/kiwix-${VERSION}.ipa --dest ci@master.download.kiwix.org:30022/data/download/${UPLOAD_FOLDER} --ssh-key ${SSH_KEY}
|
python .github/upload_file.py --src ${PWD}/export/kiwix-${VERSION}.ipa --dest ci@master.download.kiwix.org:30022/data/download/${UPLOAD_FOLDER} --ssh-key ${SSH_KEY}
|
||||||
|
47
.github/workflows/ci.yml
vendored
47
.github/workflows/ci.yml
vendored
@ -7,9 +7,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
env:
|
|
||||||
APPLE_STORE_AUTH_KEY_PATH: /tmp/authkey.p8
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
authorize:
|
authorize:
|
||||||
# sets environment based on origin of PR: internal (non-existent) for own-repo or external (requires reviewer to run) for external repos
|
# sets environment based on origin of PR: internal (non-existent) for own-repo or external (requires reviewer to run) for external repos
|
||||||
@ -20,54 +17,36 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
needs: authorize
|
needs: authorize
|
||||||
runs-on: macos-13
|
runs-on: macos-13
|
||||||
|
env:
|
||||||
|
EXTRA_XCODEBUILD: ""
|
||||||
|
APPLE_STORE_AUTH_KEY_PATH: /tmp/authkey.p8
|
||||||
|
APPLE_AUTH_PARAMS: "-authenticationKeyPath /tmp/authkey.p8 -authenticationKeyID ${{ secrets.APPLE_STORE_AUTH_KEY_ID }} -authenticationKeyIssuerID ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}"
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
destination:
|
platform: [macOS, iOS]
|
||||||
- platform: macOS
|
|
||||||
- platform: iOS
|
|
||||||
xcode_extra: -sdk iphoneos
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# /!\ important: this checks out code from the HEAD of the PR instead of the main branch (for pull_request_target)
|
# /!\ important: this checks out code from the HEAD of the PR instead of the main branch (for pull_request_target)
|
||||||
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
||||||
|
|
||||||
- name: Add Apple Store Key
|
- name: Add Apple Store Key
|
||||||
if: ${{ matrix.destination.platform == 'iOS' }}
|
if: matrix.platform == 'iOS'
|
||||||
env:
|
run: echo "${{ secrets.APPLE_STORE_AUTH_KEY }}" | base64 --decode -o ${{ env.APPLE_STORE_AUTH_KEY_PATH}}
|
||||||
APPLE_STORE_AUTH_KEY_PATH: ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
|
||||||
APPLE_STORE_AUTH_KEY: ${{ secrets.APPLE_STORE_AUTH_KEY }}
|
|
||||||
shell: bash
|
|
||||||
run: echo "${APPLE_STORE_AUTH_KEY}" | base64 --decode -o $APPLE_STORE_AUTH_KEY_PATH
|
|
||||||
|
|
||||||
- name: Extend EXTRA_XCODEBUILD
|
- name: Set EXTRA_XCODEBUILD
|
||||||
if: ${{ matrix.destination.platform == 'iOS' }}
|
if: matrix.platform == 'iOS'
|
||||||
env:
|
run: echo "EXTRA_XCODEBUILD=-sdk iphoneos ${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV
|
||||||
EXTRA_XCODEBUILD: ${{ matrix.destination.xcode_extra }}
|
|
||||||
APPLE_STORE_AUTH_KEY_PATH: ${{ env.APPLE_STORE_AUTH_KEY_PATH }}
|
|
||||||
APPLE_STORE_AUTH_KEY_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ID }}
|
|
||||||
APPLE_STORE_AUTH_KEY_ISSUER_ID: ${{ secrets.APPLE_STORE_AUTH_KEY_ISSUER_ID }}
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
extra_xcode = os.getenv("EXTRA_XCODEBUILD", "")
|
|
||||||
extra_xcode += f" -authenticationKeyPath {os.getenv('APPLE_STORE_AUTH_KEY_PATH')}"
|
|
||||||
extra_xcode += f" -authenticationKeyID {os.getenv('APPLE_STORE_AUTH_KEY_ID')}"
|
|
||||||
extra_xcode += f" -authenticationKeyIssuerID {os.getenv('APPLE_STORE_AUTH_KEY_ISSUER_ID')}"
|
|
||||||
|
|
||||||
with open(os.getenv("GITHUB_ENV"), "a") as fh:
|
|
||||||
fh.write(f"EXTRA_XCODEBUILD={extra_xcode}\n")
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: ./.github/actions/xcbuild
|
uses: ./.github/actions/xcbuild
|
||||||
with:
|
with:
|
||||||
action: build
|
action: build
|
||||||
xc-destination: generic/platform=${{ matrix.destination.platform }}
|
xc-destination: generic/platform=${{ matrix.platform }}
|
||||||
upload-to: dev
|
|
||||||
version: CI
|
version: CI
|
||||||
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }}
|
APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }}
|
||||||
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }}
|
APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }}
|
||||||
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }}
|
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ targets:
|
|||||||
- ApplicationTemplate
|
- ApplicationTemplate
|
||||||
settings:
|
settings:
|
||||||
base:
|
base:
|
||||||
MARKETING_VERSION: "3.3"
|
MARKETING_VERSION: "3.3.0"
|
||||||
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix
|
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix
|
||||||
INFOPLIST_KEY_CFBundleDisplayName: Kiwix
|
INFOPLIST_KEY_CFBundleDisplayName: Kiwix
|
||||||
INFOPLIST_FILE: Support/Info.plist
|
INFOPLIST_FILE: Support/Info.plist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user