-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (133 loc) · 5.54 KB
/
ios-sdk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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') }}