PR 320 #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test-build pull request | |
run-name: PR ${{ vars.PR_NUMBER }} | |
on: | |
workflow_dispatch: | |
jobs: | |
# Builds Trio | |
build: | |
name: Build | |
runs-on: macos-14 | |
permissions: | |
contents: write | |
steps: | |
# Uncomment to manually select Xcode version if needed | |
#- name: Select Xcode version | |
# run: "sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer" | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: nightscout/Trio | |
ref: dev | |
token: ${{ secrets.GH_PAT }} | |
submodules: recursive | |
fetch-depth: 1 | |
- name: Checkout pull request for building | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
run: | | |
gh pr checkout ${{ vars.PR_NUMBER }} --repo nightscout/Trio --recurse-submodules | |
git submodule | |
- name: Get ALTERNATIVE_BUNDLE_ID, or set empty value if it does not exist as a repository variable | |
run: echo "ALTERNATIVE_BUNDLE_ID=${{ vars.ALTERNATIVE_BUNDLE_ID }}" >> $GITHUB_ENV | |
- name: Check if alternative bundle ID is set | |
if: ${{ env.ALTERNATIVE_BUNDLE_ID == '' }} | |
run: echo 'ALTERNATIVE_BUNDLE_ID is not set. Skipping BUNDLE_IDENTIFIER configuration.' | |
- name: Use alternative bundle ID for PR test build | |
if: ${{ env.ALTERNATIVE_BUNDLE_ID != '' }} | |
run: echo 'BUNDLE_IDENTIFIER = ${{ env.ALTERNATIVE_BUNDLE_ID }}' >> Config.xcconfig | |
# Patch Fastlane Match to not print tables | |
- name: Patch Match Tables | |
run: find /usr/local/lib/ruby/gems -name table_printer.rb | xargs sed -i "" "/puts(Terminal::Table.new(params))/d" | |
# Install project dependencies | |
- name: Install project dependencies | |
run: bundle install | |
- name: Download Build Number Artifact | |
id: download-artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-number | |
path: build_number | |
continue-on-error: true | |
- name: Check if Build Number Artifact Exists | |
id: check-artifact | |
run: echo "Artifact exists" | |
continue-on-error: true | |
- name: Increment Build Number | |
run: | | |
mkdir -p build_number | |
if [ -f build_number/build_number.txt ]; then | |
echo "Previous build number found." | |
else | |
echo "Previous build number not found. Setting to 0." | |
echo "0" > build_number/build_number.txt | |
fi | |
bundle exec fastlane increment_build_number | |
echo "BUILD_NUMBER=$(cat build_number/build_number.txt)" >> $GITHUB_ENV | |
env: | |
TEAMID: ${{ secrets.TEAMID }} | |
- name: Upload Build Number Artifact | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-number | |
path: build_number/build_number.txt | |
# Build signed Trio IPA file | |
- name: Fastlane Build & Archive | |
run: bundle exec fastlane build_trio | |
env: | |
TEAMID: ${{ secrets.TEAMID }} | |
GH_PAT: ${{ secrets.GH_PAT }} | |
FASTLANE_KEY_ID: ${{ secrets.FASTLANE_KEY_ID }} | |
FASTLANE_ISSUER_ID: ${{ secrets.FASTLANE_ISSUER_ID }} | |
FASTLANE_KEY: ${{ secrets.FASTLANE_KEY }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
# Upload to TestFlight | |
- name: Fastlane upload to TestFlight | |
run: bundle exec fastlane release | |
env: | |
TEAMID: ${{ secrets.TEAMID }} | |
GH_PAT: ${{ secrets.GH_PAT }} | |
FASTLANE_KEY_ID: ${{ secrets.FASTLANE_KEY_ID }} | |
FASTLANE_ISSUER_ID: ${{ secrets.FASTLANE_ISSUER_ID }} | |
FASTLANE_KEY: ${{ secrets.FASTLANE_KEY }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
# Upload Build artifacts | |
- name: Upload build log, IPA and Symbol artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: | | |
artifacts | |
buildlog |