Make ad-hoc build #654
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: Make ad-hoc build | |
on: | |
workflow_dispatch: | |
inputs: | |
suffix: | |
description: "Text to append at the end of the build name" | |
required: false | |
asana-task-url: | |
description: "Asana task URL" | |
required: false | |
type: string | |
build-type: | |
description: "Build Configuration" | |
type: choice | |
required: true | |
default: 'Alpha' | |
options: | |
- Alpha | |
- Release | |
jobs: | |
make-adhoc: | |
runs-on: macos-14-xlarge | |
name: Make ad-hoc build | |
steps: | |
- name: Register SSH keys for access to certificates | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_FASTLANE_MATCH }} | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Select Xcode | |
run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer | |
- name: Prepare fastlane | |
run: bundle install | |
- name: Archive and upload the app | |
env: | |
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }} | |
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
APPLE_API_KEY_ISSUER: ${{ secrets.APPLE_API_KEY_ISSUER }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
run: | | |
lane_to_use="adhoc" | |
if [[ "${{ github.event.inputs.build-type }}" == "Release" ]]; then | |
lane_to_use="release_adhoc" | |
fi | |
if [[ -n "${{ github.event.inputs.suffix }}" ]]; then | |
bundle exec fastlane ${lane_to_use} suffix:${{ github.event.inputs.suffix }} | |
else | |
bundle exec fastlane ${lane_to_use} | |
fi | |
- name: Set filenames | |
run: | | |
echo "ipa_filename=${{ env.output_name }}.ipa" >> $GITHUB_ENV | |
echo "dsyms_filename=${{ env.output_name }}.app.dSYM.zip" >> $GITHUB_ENV | |
- name: Set paths | |
run: | | |
echo "ipa_path=${{ github.workspace }}/${{ env.ipa_filename }}" >> $GITHUB_ENV | |
echo "dsyms_path=${{ github.workspace }}/${{ env.dsyms_filename }}" >> $GITHUB_ENV | |
- name: Upload IPA artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ipa_filename }} | |
path: ${{ env.ipa_path }} | |
- name: Upload dSYMs artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.dsyms_filename }} | |
path: ${{ env.dsyms_path }} | |
- name: Get Asana Task ID | |
id: get-task-id | |
if: github.event.inputs.asana-task-url | |
run: | | |
task_url_regex='^https://app.asana.com/[0-9]/[0-9]*/([0-9]*)/f$' | |
if [[ "${{ github.event.inputs.asana-task-url }}" =~ ${task_url_regex} ]]; then | |
echo "task_id=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT | |
else | |
echo "::error::Asana Task URL has incorrect format (attempted to match ${task_url_regex})." | |
fi | |
- name: Upload IPA to Asana | |
if: github.event.inputs.asana-task-url | |
env: | |
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }} | |
run: | | |
curl -s "https://app.asana.com/api/1.0/tasks/${{ steps.get-task-id.outputs.task_id }}/attachments" \ | |
-H "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \ | |
--form "file=@${{ env.ipa_path }};type=application/zip" |