Skip to content

Beta - Build and Deploy #53

Beta - Build and Deploy

Beta - Build and Deploy #53

name: Beta - Build and Deploy
on:
push:
branches:
- 'develop'
- 'feature/IOS-8113_ci_cd_beta_builds_workflow' # TODO: Test only, remove
workflow_dispatch:
inputs:
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
env:
nextVersionName: 'Next Release'
jobs:
prepare:
name: Prepare information
runs-on: ubuntu-latest
outputs:
version: 'develop'
stage: 'Beta'
build_number: '${{ github.run_number }}'
changelog: '${{ steps.changelog.outputs.result }}'
steps:
- name: Get unreleased tasks
id: git-diff
uses: tangem/github-action@main
with:
github-token: '${{ secrets.GH_MOBILE_PAT }}'
base: 'master'
head: 'develop'
- 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: Jira Get Issues Summary
uses: tangem/jira-action@master
id: jira-get-issues-summary
with:
action: 'getIssuesSummary'
issues: '${{ steps.git-diff.outputs.issues }}'
- name: Jira Check Version
id: jira-check-version
uses: tangem/jira-action@master
with:
action: 'checkVersion'
project: 'IOS'
version: '${{ env.nextVersionName }}'
- name: Jira Create Version
if: false # TODO: Test only, remove
# if: ${{ steps.jira-check-version.outputs.result == 'false' }}
uses: tangem/jira-action@master
with:
action: 'createVersion'
project: 'IOS'
version: '${{ env.nextVersionName }}'
- name: Debug
env:
ISSUES: '${{ steps.git-diff.outputs.issues }}'
HAS_NEW_VERSION: '${{ steps.jira-check-version.outputs.result }}'
run: |
echo "HAS_NEW_VERSION: ${HAS_NEW_VERSION}"
echo "ISSUES: ${ISSUES}"
- name: Jira Set Version To Issues
if: false # TODO: Test only, remove
uses: tangem/jira-action@master
with:
action: 'setVersionToIssues'
project: 'IOS'
version: '${{ env.nextVersionName }}'
issues: '${{ steps.git-diff.outputs.issues }}'
- name: Create changelog
id: changelog
env:
JIRA_ISSUES_SUMMARY: '${{ steps.jira-get-issues-summary.outputs.result }}'
ADDITIONAL_CHANGELOG: '${{ inputs.changelog }}'
run: |
JIRA_ISSUES_SUMMARY="Jira issues summary:"$'\n'"${JIRA_ISSUES_SUMMARY}"
if [[ -n "${ADDITIONAL_CHANGELOG}" ]]; then
OUTPUT_VALUE="Description: ${ADDITIONAL_CHANGELOG}"$'\n'"${JIRA_ISSUES_SUMMARY}"
else
OUTPUT_VALUE="${JIRA_ISSUES_SUMMARY}"
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 Beta
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
uses: tangem/actions/.github/workflows/deploy-firebase.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
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.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
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
needs:
- prepare
- build
- deploy
with:
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}'
status: 'success'
app_name: '${{ vars.APP_BETA }}'
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()
if: false # TODO: Test only, remove
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8112_ci_cd_alpha_builds_workflow
needs:
- prepare
- build
with:
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}'
status: 'error'
app_name: '${{ vars.APP_BETA }}'
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 }}'