From b80a72785b59ef84e5a2aec1f68472d172a46052 Mon Sep 17 00:00:00 2001 From: Particle_G <38580644+ParticleG@users.noreply.github.com> Date: Thu, 21 Oct 2021 02:49:29 +0800 Subject: [PATCH] Ci ios (#399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *Bunch of ci-ios thing* Co-authored-by: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Co-authored-by: Trebor-Huang <2300936257@qq.com> Co-authored-by: Trebor Huang <41145779+Trebor-Huang@users.noreply.github.com> Co-authored-by: YunyushuLiu Co-authored-by: MrZ626 <1046101471@qq.com> Co-authored-by: 梦飞翔 <1149761294@qq.com> --- .github/actions/build-android/action.yml | 4 +- .github/actions/build-ios/action.yml | 63 +++--------------------- .github/workflows/build.yml | 10 +++- .github/workflows/getVersion.lua | 5 +- .github/workflows/release.yml | 6 ++- 5 files changed, 26 insertions(+), 62 deletions(-) diff --git a/.github/actions/build-android/action.yml b/.github/actions/build-android/action.yml index 730232d2..38dd0e4c 100644 --- a/.github/actions/build-android/action.yml +++ b/.github/actions/build-android/action.yml @@ -3,7 +3,7 @@ description: 'build Android package' inputs: type: required: true - code: + apkCode: required: true name: required: true @@ -63,7 +63,7 @@ runs: shell: bash run: | echo "${{ inputs.SIGNING_KEY }}" | base64 -d > love-android/app/android.keystore - python3 .github/workflows/updateVersion.py -T Android${{ inputs.type }} -C ${{ inputs.code }} -N ${{ inputs.name }} -S ${{ inputs.KEY_STORE_PASSWORD }} -A ${{ inputs.ALIAS }} -K ${{ inputs.KEY_PASSWORD }} + python3 .github/workflows/updateVersion.py -T Android${{ inputs.type }} -C ${{ inputs.apkCode }} -N ${{ inputs.name }} -S ${{ inputs.KEY_STORE_PASSWORD }} -A ${{ inputs.ALIAS }} -K ${{ inputs.KEY_PASSWORD }} chmod 777 love-android/gradlew cd love-android/ ./gradlew assembleRelease diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index cac553aa..fc6ef0fd 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -31,6 +31,8 @@ inputs: required: true APPLE_KEY_CONTENT: required: true + PROJECT_BUILD_NUMBER: + required: true runs: using: "composite" @@ -45,34 +47,6 @@ runs: uses: ./.github/actions/get-cc with: arch: iOS - # - name: Create and config keychain - # shell: bash - # run: | - # security create-keychain -p "" build.keychain - # security list-keychains -s build.keychain - # security default-keychain -s build.keychain - # security unlock-keychain -p "" build.keychain - # security set-keychain-settings - # security import <(echo ${{inputs.IOS_CERTIFICATE}} | base64 --decode) \ - # -f pkcs12 \ - # -k build.keychain \ - # -P ${{inputs.IOS_CERTIFICATE_PWD}} \ - # -T /usr/bin/codesign - # security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain - # - name: Import provisioning profile - # shell: bash - # run: | - # mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles - # echo "${{inputs.IOS_PROFILE}}" | base64 --decode > \ - # ~/Library/MobileDevice/Provisioning\ Profiles/dist.mobileprovision - # echo "${{inputs.IOS_PROFILE_DEV}}" | base64 --decode > \ - # ~/Library/MobileDevice/Provisioning\ Profiles/dev.mobileprovision - # - name: Sign and chmod CCloader - # shell: bash - # run: | - # security unlock-keychain -p "" build.keychain - # codesign -f -s "${{inputs.IOS_CERTIFICATE_ID}}" ./CCloader.dylib - # chmod +x ./CCloader.dylib - name: Update source codes shell: bash run: | @@ -100,31 +74,8 @@ runs: APPLE_KEY_ID: '${{ inputs.APPLE_KEY_ID }}' APPLE_ISSUER_ID: '${{ inputs.APPLE_ISSUER_ID }}' APPLE_KEY_CONTENT: '${{ inputs.APPLE_KEY_CONTENT }}' - # - name: Build project - # shell: bash - # run: | - # xcodebuild -project Techmino-iOS/platform/xcode/Techmino.xcodeproj \ - # -scheme Techmino \ - # -configuration Release \ - # -quiet \ - # CONFIGURATION_BUILD_DIR=Build - # - name: Arrange build - # shell: bash - # run: | - # mv Techmino-iOS/platform/xcode/Build/Techmino.app ./ - # - name: Archive project - # shell: bash - # run: | - # xcodebuild -project Techmino-iOS/platform/xcode/Techmino.xcodeproj \ - # -scheme Techmino \ - # -configuration Distribution \ - # -archivePath Techmino-iOS/Archive - # -quiet \ - # archive - # - name: Export archive - # shell: bash - # run: | - # xcodebuild -exportArchive \ - # -archivePath Techmino-iOS/Archive \ - # -exportOptionsPlist Techmino-iOS/ExportOptions.plist \ - # Techmino-iOS/Export + PROJECT_BUILD_NUMBER: '${{ inputs.PROJECT_BUILD_NUMBER }}' + - name: Move ipa + shell: bash + run: | + mv Techmino-iOS/platform/xcode/Techmino.ipa Techmino.ipa \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f102f474..4b558f19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-20.04 outputs: name: ${{ steps.actual-get-info.outputs.name }} + apkCode: ${{ steps.actual-get-info.outputs.apkCode }} code: ${{ steps.actual-get-info.outputs.code }} commit: ${{ steps.actual-get-info.outputs.commit }} steps: @@ -22,6 +23,7 @@ jobs: id: actual-get-info run: | echo "::set-output name=name::$(lua .github/workflows/getVersion.lua -name)" + echo "::set-output name=apkCode::$(lua .github/workflows/getVersion.lua -apkCode)" echo "::set-output name=code::$(lua .github/workflows/getVersion.lua -code)" echo "::set-output name=commit::$(git rev-parse --short ${{ GITHUB.SHA }})" @@ -74,7 +76,7 @@ jobs: - uses: ./.github/actions/build-android with: type: Snapshot - code: ${{ needs.get-info.outputs.code }} + apkCode: ${{ needs.get-info.outputs.apkCode }} name: ${{ needs.get-info.outputs.name }} file-path: Techmino_Snapshot.apk SIGNING_KEY: ${{ secrets.SIGNING_KEY }} @@ -136,3 +138,9 @@ jobs: APPLE_KEY_ID: '${{ secrets.APPLE_KEY_ID }}' APPLE_ISSUER_ID: '${{ secrets.APPLE_ISSUER_ID }}' APPLE_KEY_CONTENT: '${{ secrets.APPLE_KEY_CONTENT }}' + PROJECT_BUILD_NUMBER: '${{ needs.get-info.outputs.code }}.${{ github.run_number }}' + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: Techmino_${{ needs.get-info.outputs.name }}_${{ GITHUB.RUN_NUMBER }}_${{ needs.get-info.outputs.commit }}_iOS + path: Techmino.ipa diff --git a/.github/workflows/getVersion.lua b/.github/workflows/getVersion.lua index 9018c83c..dcd52ab9 100644 --- a/.github/workflows/getVersion.lua +++ b/.github/workflows/getVersion.lua @@ -1,6 +1,9 @@ -if arg[1]=="-code"then +if arg[1]=="-apkCode"then local code=require"version".apkCode print(code) +elseif arg[1]=="-code"then + local str=require"version".code + print(str) elseif arg[1]=="-name"then local str=require"version".string:gsub("@DEV","") print(str) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 442051e4..1562b472 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-20.04 outputs: name: ${{ steps.actual-get-info.outputs.name }} + apkCode: ${{ steps.actual-get-info.outputs.apkCode }} code: ${{ steps.actual-get-info.outputs.code }} release: ${{ steps.actual-get-info.outputs.release }} updateTitle: ${{ steps.actual-get-info.outputs.updateTitle }} @@ -23,6 +24,7 @@ jobs: id: actual-get-info run: | echo "::set-output name=name::$(lua .github/workflows/getVersion.lua -name)" + echo "::set-output name=apkCode::$(lua .github/workflows/getVersion.lua -apkCode)" echo "::set-output name=code::$(lua .github/workflows/getVersion.lua -code)" echo "::set-output name=release::$(lua .github/workflows/getVersion.lua -release)" echo "::set-output name=updateTitle::$(lua .github/workflows/getVersion.lua -updateTitle)" @@ -103,7 +105,7 @@ jobs: - uses: ./.github/actions/build-android with: type: Release - code: ${{ needs.get-info.outputs.code }} + apkCode: ${{ needs.get-info.outputs.apkCode }} name: ${{ needs.get-info.outputs.name }} file-path: Techmino.a${{ needs.get-info.outputs.release }}.apk SIGNING_KEY: ${{ secrets.SIGNING_KEY }} @@ -130,7 +132,7 @@ jobs: - uses: ./.github/actions/build-android with: type: Release - code: ${{ needs.get-info.outputs.code }} + apkCode: ${{ needs.get-info.outputs.apkCode }} name: ${{ needs.get-info.outputs.name }} file-path: Techmino.a${{ needs.get-info.outputs.release }}.mini.apk SIGNING_KEY: ${{ secrets.SIGNING_KEY }}