Alpha - Build and Deploy #760
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: Alpha - Build and Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
runner_name: | |
type: choice | |
description: > | |
Self-hosted runner to run the build. Leave blank (default value) to use the runner selected by GitHub | |
options: | |
- '' | |
- bamboo | |
- builder1 | |
- builder2 | |
- builder3 | |
- builder4 | |
default: '' | |
build_description: | |
description: > | |
Optional additional info about the build | |
type: string | |
xcode_version_override: | |
description: > | |
Optional Xcode version override. Leave blank (default value) to use the default Xcode version; | |
pass a custom value (e.g. '16.0', '10.2.1', '11 Beta 7', '11.2 GM seed', etc) to use a different Xcode version for the build | |
type: string | |
build_version_override: | |
description: > | |
Optional build version override. Leave blank (default value) to use the default value derived from the branch name | |
type: string | |
analyze_archive: | |
description: > | |
Whether the archive should be analyzed during the build process (default: false) | |
type: boolean | |
default: false | |
concurrency: | |
group: '${{ github.workflow }} (${{ github.head_ref || github.ref_name }})' | |
cancel-in-progress: true | |
jobs: | |
prepare: | |
name: Prepare information | |
runs-on: ubuntu-latest | |
outputs: | |
version: '${{ steps.version.outputs.build_version }}' | |
stage: 'Alpha' | |
build_number: '${{ github.run_number }}' | |
jira_summary: '${{ steps.jira.outputs.summary }}' | |
steps: | |
- name: Jira Login | |
uses: atlassian/gajira-login@master | |
env: | |
JIRA_BASE_URL: '${{ secrets.JIRA_URL }}' | |
JIRA_USER_EMAIL: '${{ secrets.JIRA_USER }}' | |
JIRA_API_TOKEN: '${{ secrets.JIRA_TOKEN }}' | |
- name: Get Jira Issue Number from Branch Name | |
id: jira | |
uses: tangem/jira-action@master | |
with: | |
action: getBranchSummary | |
branch-name: '${{ github.ref_name }}' | |
- name: Create version | |
id: version | |
env: | |
JIRA_ISSUE_KEY: '${{ steps.jira.outputs.key }}' | |
BUILD_VERSION_OVERRIDE: '${{ inputs.build_version_override }}' | |
run: | | |
if [[ -n "${BUILD_VERSION_OVERRIDE}" ]]; then | |
# Use the build version value from user input (if any) | |
BUILD_VERSION="${BUILD_VERSION_OVERRIDE}" | |
elif [[ -n "${JIRA_ISSUE_KEY}" ]]; then | |
# Use the build version value from Jira (if available) | |
BUILD_VERSION="${JIRA_ISSUE_KEY}" | |
else | |
# Fallback to default value | |
BUILD_VERSION="Alpha" | |
fi | |
echo "build_version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT" | |
build_notification: | |
name: Build Notification | |
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8741_ci_cd_notifications | |
needs: prepare | |
with: | |
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}' | |
status: 'building' | |
app_name: '${{ needs.prepare.outputs.version }}' | |
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
changelog: '${{ needs.prepare.outputs.jira_summary }}' | |
build_description: '${{ inputs.build_description }}' | |
secrets: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' | |
build: | |
name: Tangem Alpha | |
needs: prepare | |
uses: tangem/actions/.github/workflows/build.yml@feature/IOS-8741_ci_cd_notifications | |
with: | |
stage: '${{ needs.prepare.outputs.stage }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
path: 'fastlane/builds/' | |
filename: 'Tangem-${{ needs.prepare.outputs.stage }}-${{ needs.prepare.outputs.version }}(${{ needs.prepare.outputs.build_number }}).ipa' | |
xcode_version_override: '${{ inputs.xcode_version_override }}' | |
# GA boolean inputs are just awful https://stackoverflow.com/questions/76292948 | |
# The reusable workflow requires all input params to be of type string, so we use this ugly ternary operator here | |
analyze_archive: ${{ inputs.analyze_archive == true && 'true' || 'false' }} | |
runner_name: ${{ inputs.runner_name }} | |
secrets: | |
FIREBASE_APP_ID: '${{ secrets.FIREBASE_APP_ID }}' | |
GH_MOBILE_PAT: '${{ secrets.GH_MOBILE_PAT }}' | |
deploy_notification: | |
name: Deploy Notification | |
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8741_ci_cd_notifications | |
needs: | |
- prepare | |
- build | |
- build_notification | |
with: | |
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}' | |
message_ts: '${{ needs.build_notification.outputs.ts }}' | |
status: 'deploying' | |
app_name: '${{ needs.prepare.outputs.version }}' | |
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
changelog: '${{ needs.prepare.outputs.jira_summary }}' | |
build_description: '${{ inputs.build_description }}' | |
secrets: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' | |
deploy: | |
name: Google Distribution | |
uses: tangem/actions/.github/workflows/deploy-firebase.yml@feature/IOS-8741_ci_cd_notifications | |
needs: | |
- prepare | |
- build | |
with: | |
stage: '${{ needs.prepare.outputs.stage }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
changelog: '${{ needs.prepare.outputs.jira_summary }}' | |
build_description: '${{ inputs.build_description }}' | |
filename: 'Tangem-${{ needs.prepare.outputs.stage }}-${{ needs.prepare.outputs.version }}(${{ needs.prepare.outputs.build_number }}).ipa' | |
runner_name: ${{ inputs.runner_name }} | |
secrets: | |
FIREBASE_APP_ID: '${{ secrets.FIREBASE_APP_ID }}' | |
FIREBASE_CLI_TOKEN: '${{ secrets.FIREBASE_CLI_TOKEN }}' | |
GH_MOBILE_PAT: '${{ secrets.GH_MOBILE_PAT }}' | |
success_notification: | |
name: Success Notification | |
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8741_ci_cd_notifications | |
needs: | |
- prepare | |
- build | |
- deploy | |
- build_notification | |
with: | |
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}' | |
message_ts: '${{ needs.build_notification.outputs.ts }}' | |
status: 'success' | |
app_name: '${{ needs.prepare.outputs.version }}' | |
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
changelog: '${{ needs.prepare.outputs.jira_summary }}' | |
build_description: '${{ inputs.build_description }}' | |
encoded_release_url: '${{ needs.deploy.outputs.encoded_release_url }}' | |
secrets: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' | |
error_notification: | |
name: Error Notification | |
if: failure() | |
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8741_ci_cd_notifications | |
needs: | |
- prepare | |
- build | |
- deploy | |
- build_notification | |
with: | |
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}' | |
message_ts: '${{ needs.build_notification.outputs.ts }}' | |
status: 'error' | |
app_name: '${{ needs.prepare.outputs.version }}' | |
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
changelog: '${{ needs.prepare.outputs.jira_summary }}' | |
build_description: '${{ inputs.build_description }}' | |
secrets: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' | |
cancel_notification: | |
name: Cancel Notification | |
if: cancelled() | |
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8741_ci_cd_notifications | |
needs: | |
- prepare | |
- build | |
- deploy | |
- build_notification | |
with: | |
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}' | |
message_ts: '${{ needs.build_notification.outputs.ts }}' | |
status: 'cancel' | |
app_name: '${{ needs.prepare.outputs.version }}' | |
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}' | |
version: '${{ needs.prepare.outputs.version }}' | |
build_number: '${{ needs.prepare.outputs.build_number }}' | |
changelog: '${{ needs.prepare.outputs.jira_summary }}' | |
build_description: '${{ inputs.build_description }}' | |
secrets: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' |