mirror of
https://github.com/yattee/yattee.git
synced 2026-02-19 09:19:46 +00:00
Query App Store Connect for the latest TestFlight build number across all platforms (iOS, tvOS, macOS) and auto-increment it, eliminating the need for the separate bump-build workflow.
236 lines
8.5 KiB
YAML
236 lines
8.5 KiB
YAML
name: Build and release to TestFlight and GitHub
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
build_ios:
|
|
description: 'Build iOS (TestFlight)'
|
|
type: boolean
|
|
default: true
|
|
build_tvos:
|
|
description: 'Build tvOS (TestFlight)'
|
|
type: boolean
|
|
default: false
|
|
build_mac_beta:
|
|
description: 'Build macOS (TestFlight)'
|
|
type: boolean
|
|
default: false
|
|
build_mac_notarized:
|
|
description: 'Build macOS (notarized)'
|
|
type: boolean
|
|
default: false
|
|
create_release:
|
|
description: 'Create GitHub release'
|
|
type: boolean
|
|
default: true
|
|
|
|
concurrency:
|
|
group: release
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
APP_NAME: Yattee
|
|
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
|
|
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
|
|
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
|
|
TEAM_ID: ${{ secrets.TEAM_ID }}
|
|
DEVELOPER_KEY_ID: ${{ secrets.DEVELOPER_KEY_ID }}
|
|
DEVELOPER_KEY_ISSUER_ID: ${{ secrets.DEVELOPER_KEY_ISSUER_ID }}
|
|
DEVELOPER_KEY_CONTENT: ${{ secrets.DEVELOPER_KEY_CONTENT }}
|
|
TEMP_KEYCHAIN_USER: ${{ secrets.TEMP_KEYCHAIN_USER }}
|
|
TEMP_KEYCHAIN_PASSWORD: ${{ secrets.TEMP_KEYCHAIN_PASSWORD }}
|
|
DEVELOPER_APP_IDENTIFIER: ${{ secrets.DEVELOPER_APP_IDENTIFIER }}
|
|
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
|
|
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
|
CERTIFICATES_GIT_URL: ${{ secrets.CERTIFICATES_GIT_URL }}
|
|
TESTFLIGHT_EXTERNAL_GROUPS: ${{ secrets.TESTFLIGHT_EXTERNAL_GROUPS }}
|
|
|
|
jobs:
|
|
determine_build_number:
|
|
name: Determine build number
|
|
runs-on: macos-latest
|
|
outputs:
|
|
build_number: ${{ steps.calc.outputs.build_number }}
|
|
version_number: ${{ steps.version.outputs.version_number }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.1'
|
|
bundler-cache: true
|
|
cache-version: 1
|
|
- uses: maierj/fastlane-action@v3.0.0
|
|
with:
|
|
lane: latest_build_number
|
|
- name: Calculate next build number
|
|
id: calc
|
|
run: |
|
|
LATEST=$(cat latest_build_number.txt)
|
|
NEXT=$((LATEST + 1))
|
|
echo "build_number=$NEXT" >> $GITHUB_OUTPUT
|
|
- name: Read version number
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep -m 1 MARKETING_VERSION Yattee.xcodeproj/project.pbxproj | cut -d' ' -f3 | sed 's/;//g')
|
|
echo "version_number=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
ios_beta:
|
|
if: ${{ inputs.build_ios }}
|
|
needs: [determine_build_number]
|
|
name: Release iOS to TestFlight
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.1'
|
|
bundler-cache: true
|
|
cache-version: 1
|
|
- name: Set signing to manual for CI
|
|
run: |
|
|
sed -i '' 's/CODE_SIGN_STYLE = Automatic/CODE_SIGN_STYLE = Manual/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Set build number
|
|
run: |
|
|
sed -i '' 's/CURRENT_PROJECT_VERSION = [0-9]*/CURRENT_PROJECT_VERSION = ${{ needs.determine_build_number.outputs.build_number }}/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Clear SPM cache
|
|
run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts
|
|
- uses: maierj/fastlane-action@v3.0.0
|
|
with:
|
|
lane: ios beta
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ios-beta-build
|
|
path: fastlane/builds/**/*.ipa
|
|
if-no-files-found: ignore
|
|
|
|
tvos_beta:
|
|
if: ${{ inputs.build_tvos }}
|
|
needs: [determine_build_number]
|
|
name: Release tvOS to TestFlight
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.1'
|
|
bundler-cache: true
|
|
cache-version: 1
|
|
- name: Set signing to manual for CI
|
|
run: |
|
|
sed -i '' 's/CODE_SIGN_STYLE = Automatic/CODE_SIGN_STYLE = Manual/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Set build number
|
|
run: |
|
|
sed -i '' 's/CURRENT_PROJECT_VERSION = [0-9]*/CURRENT_PROJECT_VERSION = ${{ needs.determine_build_number.outputs.build_number }}/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Clear SPM cache
|
|
run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts
|
|
- uses: maierj/fastlane-action@v3.0.0
|
|
with:
|
|
lane: tvos beta
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: tvos-beta-build
|
|
path: fastlane/builds/**/*.ipa
|
|
if-no-files-found: ignore
|
|
|
|
mac_beta:
|
|
if: ${{ inputs.build_mac_beta }}
|
|
needs: [determine_build_number]
|
|
name: Release macOS to TestFlight
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.1'
|
|
bundler-cache: true
|
|
cache-version: 1
|
|
- name: Set signing to manual for CI
|
|
run: |
|
|
sed -i '' 's/CODE_SIGN_STYLE = Automatic/CODE_SIGN_STYLE = Manual/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Set build number
|
|
run: |
|
|
sed -i '' 's/CURRENT_PROJECT_VERSION = [0-9]*/CURRENT_PROJECT_VERSION = ${{ needs.determine_build_number.outputs.build_number }}/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Clear SPM cache
|
|
run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts
|
|
- uses: maierj/fastlane-action@v3.0.0
|
|
with:
|
|
lane: mac beta
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mac-beta-build
|
|
path: fastlane/builds/**/*.pkg
|
|
if-no-files-found: ignore
|
|
|
|
mac_notarized:
|
|
if: ${{ inputs.build_mac_notarized }}
|
|
needs: [determine_build_number]
|
|
name: Build and notarize macOS app
|
|
runs-on: macos-latest
|
|
env:
|
|
BUILD_NUMBER: ${{ needs.determine_build_number.outputs.build_number }}
|
|
VERSION_NUMBER: ${{ needs.determine_build_number.outputs.version_number }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.1'
|
|
bundler-cache: true
|
|
cache-version: 1
|
|
- name: Set signing to manual with Developer ID
|
|
run: |
|
|
sed -i '' 's/CODE_SIGN_STYLE = Automatic/CODE_SIGN_STYLE = Manual/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Set build number
|
|
run: |
|
|
sed -i '' 's/CURRENT_PROJECT_VERSION = [0-9]*/CURRENT_PROJECT_VERSION = ${{ env.BUILD_NUMBER }}/' Yattee.xcodeproj/project.pbxproj
|
|
- name: Clear SPM cache
|
|
run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts
|
|
- uses: maierj/fastlane-action@v3.0.0
|
|
with:
|
|
lane: mac build_and_notarize
|
|
- run: |
|
|
echo "APP_PATH=fastlane/builds/${{ env.VERSION_NUMBER }}-${{ env.BUILD_NUMBER }}/macOS/Yattee.app" >> $GITHUB_ENV
|
|
echo "ZIP_PATH=fastlane/builds/${{ env.VERSION_NUMBER }}-${{ env.BUILD_NUMBER }}/macOS/Yattee-${{ env.VERSION_NUMBER }}-macOS.zip" >> $GITHUB_ENV
|
|
- name: ZIP build
|
|
run: /usr/bin/ditto -c -k --keepParent ${{ env.APP_PATH }} ${{ env.ZIP_PATH }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mac-notarized-build
|
|
path: ${{ env.ZIP_PATH }}
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
if: ${{ inputs.create_release && !cancelled() }}
|
|
needs: [determine_build_number, ios_beta, tvos_beta, mac_beta, mac_notarized]
|
|
name: Create GitHub release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
env:
|
|
BUILD_NUMBER: ${{ needs.determine_build_number.outputs.build_number }}
|
|
VERSION_NUMBER: ${{ needs.determine_build_number.outputs.version_number }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GIT_AUTHORIZATION }}
|
|
- name: Commit build number
|
|
run: |
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
sed -i 's/CURRENT_PROJECT_VERSION = [0-9]*/CURRENT_PROJECT_VERSION = ${{ env.BUILD_NUMBER }}/' Yattee.xcodeproj/project.pbxproj
|
|
git add Yattee.xcodeproj/project.pbxproj
|
|
git commit -m "Bump build number to ${{ env.BUILD_NUMBER }}"
|
|
git push
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
- uses: ncipollo/release-action@v1
|
|
with:
|
|
artifacts: artifacts/**/*.ipa,artifacts/**/*.zip,artifacts/**/*.pkg
|
|
commit: main
|
|
tag: ${{ env.VERSION_NUMBER }}-${{ env.BUILD_NUMBER }}
|
|
prerelease: true
|
|
bodyFile: CHANGELOG.md
|
|
|
|
update_altstore:
|
|
needs: [release]
|
|
uses: ./.github/workflows/update-altstore.yml
|