Skip to content

Alpha - Build and Deploy #286

Alpha - Build and Deploy

Alpha - Build and Deploy #286

name: Alpha - Build and Deploy
on:
workflow_dispatch:
inputs:
build_version_override:
description: >
Optional build version override. Leave blank (default value) to use the default value derived from the branch name
type: string
changelog:
description: >
Optional additional info about 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
concurrency:
group: '${{ github.workflow }} (${{ github.head_ref || github.ref_name }})'
cancel-in-progress: true
jobs:
prepare:
name: Prepare information
runs-on: [builder1]
outputs:
version: '${{ steps.version.outputs.build_version }}'
stage: Alpha
build_number: '${{ github.run_number }}'
changelog: '${{ steps.changelog.outputs.result }}'
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: |
BUILD_VERSION=""
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"
- name: Create changelog
id: changelog
env:
JIRA_ISSUE_SUMMARY: '${{ steps.jira.outputs.summary }}'
JIRA_ISSUE_KEY: '${{ steps.jira.outputs.key }}'
ADDITIONAL_CHANGELOG: '${{ inputs.changelog }}'
run: |
JIRA_DESCRIPTION="Jira issue: ${JIRA_ISSUE_KEY} ${JIRA_ISSUE_SUMMARY}"
if [[ -n "${ADDITIONAL_CHANGELOG}" ]]; then
OUTPUT_VALUE="Description: ${ADDITIONAL_CHANGELOG}"$'\n'"${JIRA_DESCRIPTION}"
else
OUTPUT_VALUE="${JIRA_DESCRIPTION}"
fi
# Workaround for a multi-line text in GH output
echo 'result<<EOF' >> $GITHUB_OUTPUT
echo "${OUTPUT_VALUE}" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
build:
name: Tangem Alpha
needs: prepare
uses: tangem/actions/.github/workflows/build.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
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
needs:
- prepare
- build
uses: tangem/actions/.github/workflows/deploy-firebase.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
with:
stage: '${{ needs.prepare.outputs.stage }}'
version: '${{ needs.prepare.outputs.version }}'
build_number: '${{ needs.prepare.outputs.build_number }}'
changelog: '${{ needs.prepare.outputs.changelog }}'
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
needs:
- prepare
- build
- deploy
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
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.changelog }}'
secrets:
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}'
error_notification:
name: Error Notification
if: failure()
needs:
- prepare
- build
- deploy
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
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.changelog }}'
secrets:
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}'