WalletIOS-SDK #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: WalletIOS-SDK | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Configuration environment | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- rc | |
- prod | |
env: | |
GLOBAL_ENV: ${{ github.event_name == 'push' && format('{0}', 'dev') || inputs.environment }} | |
jobs: | |
tests-ios-sdk: | |
runs-on: macos-14 | |
env: | |
#Xcode config | |
XC_VERSION: "16.0" | |
steps: | |
# Git clone repository | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
# Select latest Xcode | |
- name: Select latest Xcode | |
run: "sudo xcode-select -s /Applications/Xcode_${{ env.XC_VERSION }}.app" | |
- name: Run tests | |
run: xcodebuild test -project VCL.xcodeproj -scheme VCL -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' | |
working-directory: VCL | |
set-environment: | |
runs-on: ubuntu-latest | |
steps: | |
- id: environment | |
name: Set Environment | |
run: | | |
echo "GLOBAL_ENV=${{ env.GLOBAL_ENV }}" >> "$GITHUB_OUTPUT" | |
env: | |
SCHEME: ${{ env.GLOBAL_ENV }} | |
outputs: | |
GLOBAL_ENV: ${{ steps.environment.outputs.GLOBAL_ENV }} | |
build-ios-sdk: | |
if: needs.set-environment.outputs.GLOBAL_ENV == 'prod' || needs.set-environment.outputs.GLOBAL_ENV == 'rc' | |
needs: | |
- tests-ios-sdk | |
- set-environment | |
runs-on: macos-14 | |
env: | |
#Xcode config | |
XC_VERSION: "16.0" | |
#Certs | |
ENCRYPTED_CERTS_FILE_PATH: "./certs.p12.tar.gz.gpg" | |
DECRYPTED_CERTS_FILE_PATH: "./certs.p12.tar.gz" | |
CERTS_FILE_PATH: "./certs.p12" | |
# Recomends to use separated PAT token to access to another repos | |
PAT_TOKEN: ${{ secrets.VCL_RW_ACCESS_TOKEN }} | |
KEYCHAIN: "velocity.keychain" | |
RC_SUFFIX: 'rc' | |
GLOBAL_ENV: ${{ needs.set-environment.outputs.GLOBAL_ENV }} | |
steps: | |
# Git clone repository | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
# Select latest Xcode | |
- name: Select latest Xcode | |
run: "sudo xcode-select -s /Applications/Xcode_${{ env.XC_VERSION }}.app" | |
# Extract branch name | |
- name: Extract branch name | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV | |
# Certificate | |
- name: Certificate | |
run: "echo ${{ secrets.APPLE_CERTS_BASE64 }} | base64 -d > ${{ env.ENCRYPTED_CERTS_FILE_PATH }}" | |
# Configure keychain and code signing | |
- name: Configure keychain and code signing | |
run: | | |
security create-keychain -p "" "${{ env.KEYCHAIN }}" | |
security list-keychains -s "${{ env.KEYCHAIN }}" | |
security unlock-keychain -p "" ${{ env.KEYCHAIN }} | |
security set-keychain-settings ${{ env.KEYCHAIN }} | |
security default-keychain -s ${{ env.KEYCHAIN }} | |
security list-keychains | |
gpg -d -o "${{ env.DECRYPTED_CERTS_FILE_PATH }}" --pinentry-mode=loopback --passphrase "${{ secrets.CERTS_ENCRYPTION_PWD }}" "${{ env.ENCRYPTED_CERTS_FILE_PATH }}" | |
tar xzvf ${{ env.DECRYPTED_CERTS_FILE_PATH }} | |
security import "${{ env.CERTS_FILE_PATH }}" -k "${{ env.KEYCHAIN }}" -P "${{ secrets.CERTS_ENCRYPTION_PWD }}" -A | |
security set-key-partition-list -S apple-tool:,apple: -s -k "" "${{ env.KEYCHAIN }}" | |
security find-identity -p codesigning -v | |
# VCL build | |
- name: VCL build | |
run: scripts/build_xcframework.sh | |
working-directory: VCL | |
# Git Set Identity | |
- name: Git Identity | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
# Get Version | |
- name: Get Version | |
run: echo "FRAMEWORK_VERSION=$(cat VCL.xcodeproj/project.pbxproj | grep PRODUCT_BUNDLE_IDENTIFIER -B 1 | grep MARKETING_VERSION | cut -d'=' -f2 | uniq | sed -e 's/^[ \t]*//;s/;//')${{ env.RELEASE_TAG }}" >> $GITHUB_ENV | |
working-directory: VCL | |
env: | |
# RELEASE_TAG: ${{ env.GLOBAL_ENV != 'prod' && format('{0}{1}', '-', env.RC_SUFFIX ) || '' }} | |
RELEASE_TAG: ${{ '' }} | |
# Clone Additional repos | |
- name: Clone Additional repos | |
run: | | |
git clone https://${{ env.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/Specs.git | |
git clone https://${{ env.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/VCL-Swift.git | |
# Publish to Specs | |
- name: Publish to Specs | |
run: | | |
cp -r VCL/0.6.0 VCL/${{ env.FRAMEWORK_VERSION }} | |
sed -i '' 's/0\.6\.0/${{ env.FRAMEWORK_VERSION }}/g' VCL/${{ env.FRAMEWORK_VERSION }}/VCL.podspec | |
git add VCL/${{ env.FRAMEWORK_VERSION }} && git commit -am "sdk ${{ env.FRAMEWORK_VERSION }}" && git push | |
env: | |
GITHUB_TOKEN: ${{ env.PAT_TOKEN }} | |
working-directory: Specs | |
# Publish to VCL-Swift | |
- name: Publish to VCL-Swift | |
run: | | |
cp -r ../VCL/build/VCL.xcframework Frameworks/ | |
git add Frameworks/ && git commit -am "sdk ${{ env.FRAMEWORK_VERSION }}" && git push | |
git tag ${{ env.FRAMEWORK_VERSION }} | |
git push origin ${{ env.FRAMEWORK_VERSION }} | |
echo ${{ env.PAT_TOKEN }} | gh auth login --with-token | |
gh release create ${{ env.FRAMEWORK_VERSION }} --title "VCL-${{ env.FRAMEWORK_VERSION }}" ${{ env.RELEASE_ARG }} | |
working-directory: VCL-Swift | |
env: | |
RELEASE_ARG: ${{ env.GLOBAL_ENV != 'prod' && format('{0}', '--prerelease' ) || format('{0}', '--latest') }} |