Skip to content

Alpha - Build and Deploy #361

Alpha - Build and Deploy

Alpha - Build and Deploy #361

name: Alpha - Build and Deploy
on:
workflow_dispatch:
inputs:
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
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="develop"
fi
echo "build_version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT"
build:
name: Tangem Alpha
needs: prepare
uses: tangem/actions/.github/workflows/build.yml@test/ci_cd_builder2_tests
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 }}'
secrets:
GH_MOBILE_PAT: '${{ secrets.GH_MOBILE_PAT }}'
deploy:
name: Google Distribution
uses: tangem/actions/.github/workflows/deploy-firebase.yml@test/ci_cd_builder2_tests
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'
secrets:
FIREBASE_APP_ID: '${{ secrets.FIREBASE_APP_ID }}'
FIREBASE_CLI_TOKEN: '${{ secrets.FIREBASE_CLI_TOKEN }}'
GH_MOBILE_PAT: '${{ secrets.GH_MOBILE_PAT }}'
notification:
name: Deploy Notification
uses: tangem/actions/.github/workflows/notification.yml@test/ci_cd_builder2_tests
needs:
- prepare
- build
- deploy
with:
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}'
status: 'success'
app_name: '${{ vars.APP_ALPHA }}'
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: false # TODO: Remove
# if: failure()
uses: tangem/actions/.github/workflows/notification.yml@test/ci_cd_builder2_tests
needs:
- prepare
- build
with:
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}'
status: 'error'
app_name: '${{ vars.APP_ALPHA }}'
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 }}'