|
| 1 | +name: Siksha-CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - testflight/v[0-9]+.[0-9]+.[0-9]+-*.[0-9]+ |
| 7 | + - appstore/v[0-9]+.[0-9]+.[0-9]+-*.[0-9]+ |
| 8 | + |
| 9 | +jobs: |
| 10 | + deploy: |
| 11 | + name: Execute fastlane for testflight / appstore |
| 12 | + |
| 13 | + env: |
| 14 | + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} |
| 15 | + SSH_KEY: ${{ secrets.SSH_KEY }} |
| 16 | + APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} |
| 17 | + APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} |
| 18 | + APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }} |
| 19 | + SLACK_URL: ${{ secrets.SLACK_WEBHOOK }} |
| 20 | + GIT_TAG_NAME: ${{ github.ref_name }} |
| 21 | + XCODE_VERSION: "16.2" |
| 22 | + |
| 23 | + runs-on: macos-15 |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Parse tag name |
| 27 | + uses: actions-ecosystem/action-regex-match@v2 |
| 28 | + id: regex |
| 29 | + with: |
| 30 | + text: ${{ github.ref_name }} |
| 31 | + regex: '^(testflight|appstore)\/v(\d+)\.(\d+)\.(\d+)-(release|debug)\.(\d+)$' |
| 32 | + |
| 33 | + - if: ${{ steps.regex.outputs.group1 == 'appstore' && steps.regex.outputs.group5 == 'debug' }} |
| 34 | + run: | |
| 35 | + echo "you can't upload debug build to appstore!" |
| 36 | + exit 1 |
| 37 | +
|
| 38 | + - uses: actions/checkout@v3 |
| 39 | + |
| 40 | + - run: | |
| 41 | + sudo xcode-select -s /Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer |
| 42 | + ls |
| 43 | +
|
| 44 | + - name: Set version number and build number |
| 45 | + run: | |
| 46 | + echo "VERSION_NUMBER=${{ steps.regex.outputs.group2 }}.${{ steps.regex.outputs.group3 }}.${{ steps.regex.outputs.group4 }}" >> $GITHUB_ENV |
| 47 | + echo "BUILD_NUMBER=${{ steps.regex.outputs.group6 }}" >> $GITHUB_ENV |
| 48 | +
|
| 49 | + - name: Install Ruby Dependencies |
| 50 | + run: | |
| 51 | + bundle install |
| 52 | + bundle update fastlane |
| 53 | +
|
| 54 | + - name: Setup match repo ssh |
| 55 | + uses: shimataro/ssh-key-action@v2 |
| 56 | + with: |
| 57 | + key: ${{ secrets.SSH_KEY }} |
| 58 | + known_hosts: ${{ secrets.KNOWN_HOSTS }} |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + - name: Inject secret file dependencies |
| 63 | + env: |
| 64 | + BUNDLE: ${{ secrets.BUNDLE }} |
| 65 | + BUNDLE_DEV: ${{secrets.BUNDLE_DEV}} |
| 66 | + CONFIG: ${{ secrets.CONFIG }} |
| 67 | + GOOGLE_SERVICE_INFO: ${{ secrets.GOOGLE_SERVICE_INFO }} |
| 68 | + GOOGLE_SERVICE_INFO_DEV: ${{ secrets.GOOGLE_SERVICE_INFO_DEV }} |
| 69 | + run: | |
| 70 | + echo "$BUNDLE" > Siksha/Supporting Files/bundle.xcconfig |
| 71 | + echo "$BUNDLE_DEV" > Siksha/Supporting Files/bundle-dev.xcconfig |
| 72 | + echo "$CONFIG" > Siksha/Supporting Files/config.plist |
| 73 | + echo "$GOOGLE_SERVICE_INFO" > Siksha/Supporting Files/GoogleService-Info.plist |
| 74 | + echo "$GOOGLE_SERVICE_INFO_DEV" > Siksha/Supporting Files/GoogleService-Info-dev.xcconfig |
| 75 | +
|
| 76 | +
|
| 77 | + - name: Upload prod app to TestFlight |
| 78 | + if: ${{ steps.regex.outputs.group1 == 'testflight' && steps.regex.outputs.group5 == 'release' }} |
| 79 | + run: | |
| 80 | + bundle exec fastlane beta --env prod |
| 81 | +
|
0 commit comments