Add bump build action

This commit is contained in:
Arkadiusz Fal 2023-02-25 13:59:49 +01:00
parent 0995e3ee2f
commit 0c7af0351b
6 changed files with 98 additions and 39 deletions

View File

@ -6,6 +6,7 @@ on:
workflow_dispatch:
env:
APP_NAME: Yattee
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
@ -22,7 +23,29 @@ env:
TESTFLIGHT_EXTERNAL_GROUPS: ${{ secrets.TESTFLIGHT_EXTERNAL_GROUPS }}
jobs:
bump_build:
name: Bump build number
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Configure git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- uses: maierj/fastlane-action@v3.0.0
with:
lane: bump_build
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GIT_AUTHORIZATION }}
branch: ${{ github.ref }}
testflight:
needs: bump_build
strategy:
matrix:
lane: ['mac beta', 'ios beta', 'tvos beta']
@ -47,6 +70,7 @@ jobs:
path: fastlane/builds/**/*.ipa
if-no-files-found: ignore
mac_notarized:
needs: bump_build
name: Build and notarize macOS app
runs-on: macos-latest
steps:
@ -76,7 +100,7 @@ jobs:
path: ${{ env.ZIP_PATH }}
if-no-files-found: error
release:
needs: ['testflight', 'mac_notarized']
needs: ['bump_build', 'testflight', 'mac_notarized']
name: Create GitHub release
runs-on: ubuntu-latest
steps:

4
.gitignore vendored
View File

@ -97,3 +97,7 @@ iOSInjectionProject/
# User-specific xcconfig files
Xcode-config/DEVELOPMENT_TEAM.xcconfig
# Bundler
.bundle/
Vendor/bundle/

1
AS_CONNECT_BUILD_VERSION Normal file
View File

@ -0,0 +1 @@
136

View File

@ -211,6 +211,7 @@ GEM
PLATFORMS
arm64-darwin-21
x86_64-darwin-19
x86_64-linux
DEPENDENCIES
fastlane

View File

@ -1,17 +1,19 @@
CERTIFICATES_GIT_URL="git@github.com:developer/yattee-certificates.git"
APP_NAME = "Yattee"
CERTIFICATES_GIT_URL = "git@github.com:developer/yattee-certificates.git"
GIT_AUTHORIZATION = "" # For certificates repo, https://github.com/settings/tokens/new (repo scope)
FASTLANE_USER="developer@mail.com" # Apple ID
FASTLANE_PASSWORD="" # Apple ID Password
ITC_TEAM_ID="" # https://sarunw.com/posts/fastlane-find-team-id/
TEAM_ID="" # Developer ID
DEVELOPER_NAME="" # Developer Name (Developer ID)
FASTLANE_USER = "developer@mail.com" # Apple ID
FASTLANE_PASSWORD = "" # Apple ID Password
ITC_TEAM_ID = "" # https://sarunw.com/posts/fastlane-find-team-id/
TEAM_ID = "" # Developer ID
DEVELOPER_NAME = "" # Developer Name (Developer ID)
# Developer Key
DEVELOPER_KEY_ID=""
DEVELOPER_KEY_ISSUER_ID=""
DEVELOPER_KEY_CONTENT=""
DEVELOPER_KEY_ID = ""
DEVELOPER_KEY_ISSUER_ID = ""
DEVELOPER_KEY_CONTENT = ""
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD="" # Not needed for most users
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD = "" # Not needed for most users
TEMP_KEYCHAIN_USER = "keychain-user"
TEMP_KEYCHAIN_PASSWORD = "keychain-password"
DEVELOPER_APP_IDENTIFIER = "stream.yattee.app"

View File

@ -13,6 +13,7 @@
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
APP_NAME = ENV['APP_NAME']
DEVELOPER_KEY_ID = ENV['DEVELOPER_KEY_ID']
DEVELOPER_KEY_ISSUER_ID = ENV['DEVELOPER_KEY_ISSUER_ID']
DEVELOPER_KEY_CONTENT = ENV['DEVELOPER_KEY_CONTENT']
@ -23,6 +24,11 @@ DEVELOPER_APP_IDENTIFIER = ENV['DEVELOPER_APP_IDENTIFIER']
GIT_AUTHORIZATION = ENV['GIT_AUTHORIZATION']
TESTFLIGHT_EXTERNAL_GROUPS = ENV['TESTFLIGHT_EXTERNAL_GROUPS']
AS_CONNECT_BUILD_VERSION_FILENAME = 'AS_CONNECT_BUILD_VERSION'
AS_CONNECT_BUILD_VERSION_PATH = "../#{AS_CONNECT_BUILD_VERSION_FILENAME}"
XCODEPROJ = "#{APP_NAME}.xcodeproj"
def delete_temp_keychain(name)
delete_keychain(
name: name
@ -51,17 +57,38 @@ end
desc "Bump build number and commit"
lane :bump_build do
increment_build_number
commit_version_bump(
message: "Bump build number to #{get_build_number}"
)
as_connect_build_version = File.read(AS_CONNECT_BUILD_VERSION_PATH).to_i
build = get_build_number(xcodeproj: XCODEPROJ).to_i
puts "AS Connect build version: #{as_connect_build_version}"
puts "Current build number: #{build}"
if build <= as_connect_build_version
new_build_number = as_connect_build_version + 1
increment_build_number
actual_build_number = get_build_number(xcodeproj: XCODEPROJ).to_i
puts "Bumped build number to #{actual_build_number}"
File.open(AS_CONNECT_BUILD_VERSION_PATH, 'w+') { |file| file.write("#{new_build_number}\n") }
commit_version_bump(
message: "Bump build number to #{get_build_number(xcodeproj: XCODEPROJ)}",
include: [AS_CONNECT_BUILD_VERSION_FILENAME],
xcodeproj: XCODEPROJ
)
else
puts "Current build number is higher than App Store Connect build version"
end
end
desc "Bump version number and commit"
lane :bump_version do
increment_version_number
commit_version_bump(
message: "Bump version number to #{get_version_number}"
message: "Bump version number to #{get_version_number}",
xcodeproj: XCODEPROJ
)
end
@ -76,16 +103,16 @@ platform :ios do
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: "Yattee.xcodeproj")
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: "Yattee.xcodeproj",
target: "Yattee (iOS)"
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (iOS)"
)
match(
type: 'appstore',
platform: 'ios',
app_identifier: ["#{DEVELOPER_APP_IDENTIFIER}", "#{DEVELOPER_APP_IDENTIFIER}.Open-in-Yattee"],
app_identifier: ["#{DEVELOPER_APP_IDENTIFIER}", "#{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}"],
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
readonly: true,
keychain_name: TEMP_KEYCHAIN_USER,
@ -94,13 +121,13 @@ platform :ios do
)
build_app(
scheme: "Yattee (iOS)",
scheme: "#{APP_NAME} (iOS)",
output_directory: "fastlane/builds/#{version}-#{build}/iOS",
output_name: "Yattee-#{version}-iOS.ipa",
output_name: "#{APP_NAME}-#{version}-iOS.ipa",
export_options: {
provisioningProfiles: {
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}",
"#{DEVELOPER_APP_IDENTIFIER}.Open-in-Yattee" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}.Open-in-Yattee"
"#{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}"
}
}
)
@ -128,10 +155,10 @@ platform :tvos do
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: "Yattee.xcodeproj")
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: "Yattee.xcodeproj",
target: "Yattee (tvOS)"
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (tvOS)"
)
match(
@ -146,9 +173,9 @@ platform :tvos do
)
build_app(
scheme: "Yattee (tvOS)",
scheme: "#{APP_NAME} (tvOS)",
output_directory: "fastlane/builds/#{version}-#{build}/tvOS",
output_name: "Yattee-#{version}-tvOS.ipa",
output_name: "#{APP_NAME}-#{version}-tvOS.ipa",
export_method: "app-store",
export_options: {
provisioningProfiles: {
@ -180,10 +207,10 @@ platform :mac do
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: "Yattee.xcodeproj")
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: "Yattee.xcodeproj",
target: "Yattee (macOS)"
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (macOS)"
)
match(
@ -199,9 +226,9 @@ platform :mac do
)
build_app(
scheme: "Yattee (macOS)",
scheme: "#{APP_NAME} (macOS)",
output_directory: "fastlane/builds/#{version}-#{build}/macOS",
output_name: "Yattee-#{version}-macOS.app",
output_name: "#{APP_NAME}-#{version}-macOS.app",
export_method: "app-store",
export_options: {
provisioningProfiles: {
@ -231,10 +258,10 @@ platform :mac do
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: "Yattee.xcodeproj")
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: "Yattee.xcodeproj",
target: "Yattee (macOS)"
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (macOS)"
)
match(
@ -249,9 +276,9 @@ platform :mac do
)
build_mac_app(
scheme: "Yattee (macOS)",
scheme: "#{APP_NAME} (macOS)",
output_directory: "fastlane/builds/#{version}-#{build}/macOS",
output_name: "Yattee",
output_name: "#{APP_NAME}",
export_method: "developer-id",
export_options: {
provisioningProfiles: {
@ -261,7 +288,7 @@ platform :mac do
)
notarize(
package: "fastlane/builds/#{version}-#{build}/macOS/Yattee.app",
package: "fastlane/builds/#{version}-#{build}/macOS/#{APP_NAME}.app",
bundle_id: "#{DEVELOPER_APP_IDENTIFIER}",
api_key: api_key,
)