Publishing to the App Store with Fastlane and GitHub Actions

Why Fastlane?

Generating App Store Connect API key

Creating an App Store Connect API Key

cat [YOUR_KEY_NAME].p8 | base64

Storing your secrets

Set up your GitHub Actions workflow .yml file

name: iOS binary build & upload

on:
workflow_dispatch:

jobs:
deploy:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
bundler-cache: true

- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.IOS_DIST_SIGNING_KEY }}
p12-password: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }}

- name: Build & upload iOS binary
run: bundle exec fastlane ios build_upload_testflight
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY: ${{ secrets.ASC_PRIVATE_KEY }}
KEYCHAIN_PATH: ~/Library/Keychains/signing_temp.keychain-db

- name: Upload app-store ipa and dsyms to artifacts
uses: actions/upload-artifact@v2
with:
name: app-store ipa & dsyms
path: |
${{ github.workspace }}/example-iOS.ipa
${{ github.workspace }}/*.app.dSYM.zip
jobs:
deploy:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2 # omit if .ruby-version file exists in project, or replace with your team’s supported ruby version
bundler-cache: true
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.IOS_DIST_SIGNING_KEY }}
p12-password: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }}
- name: Build & deploy iOS release
run: bundle exec fastlane ios build_upload_testflight
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY: ${{ secrets.ASC_PRIVATE_KEY }}
KEYCHAIN_PATH: ~/Library/Keychains/signing_temp.keychain-db

Running your build

Feel free to connect with me on LinkedIn and check out my GitHub profile.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store