Files
super-app/.github/workflows/branch-cut.yml
2025-01-27 07:53:05 +00:00

72 lines
2.8 KiB
YAML

name: Branch Cut CI
on:
workflow_dispatch:
inputs:
version_code:
description: Version Code (e.g., 301)
required: true
type: string
version_name:
description: Version Name (e.g., 3.0.1)
required: true
type: string
jobs:
print-inputs:
runs-on: [ default ]
steps:
- name: Print Inputs
run: |
echo "| Input Key | Input Value |" >> $GITHUB_STEP_SUMMARY
echo "| :---: | :---: |" >> $GITHUB_STEP_SUMMARY
echo "| Version Code | ${{ inputs.version_code }} |" >> $GITHUB_STEP_SUMMARY
echo "| Version Name | ${{ inputs.version_name }} |" >> $GITHUB_STEP_SUMMARY
branch-cut:
runs-on: [ default ]
defaults:
run:
working-directory: android
needs: [ print-inputs ]
environment: release
steps:
- name: Create GitHub App Token
uses: navi-synced-actions/actions-create-github-app-token@v1
id: get-token
with:
private-key: ${{ secrets.GH_APP_NAVI_ANDROID_PEM }}
app-id: ${{ secrets.GH_APP_NAVI_ANDROID_ID }}
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ steps.get-token.outputs.token }}
- name: Setup Git Credentials for navi-android[bot]
run: |
git config --global user.name "navi-android[bot]"
git config --global user.email "194247829+navi-android[bot]@users.noreply.github.com"
- name: Checkout release-${{ inputs.version_name }} from ${{ github.ref_name }}
run: git checkout -b release-${{ inputs.version_name }}
- name: Update Version Name (${{ inputs.version_name }}) & Version Code (${{ inputs.version_code }})
run: |
sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ inputs.version_name }}"/g' app/build.gradle
sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ inputs.version_code }}/g' app/build.gradle
- name: Commit Version Changes
run: git commit app/build.gradle -m "NTP-7561 | Bump Project Version to ${{ inputs.version_name }} (${{ inputs.version_code }})"
- name: Push release-${{ inputs.version_name }} Branch
run: git push -u origin release-${{ inputs.version_name }}
jira-release:
runs-on: [ default ]
needs: [ branch-cut ]
steps:
- name: Create JIRA Release
uses: navi-synced-actions/justin-jhg-jira-release-actions@v1
with:
jira_base_url: ${{ secrets.JIRA_BASE_URL }}
jira_user_email: ${{ secrets.JIRA_USER_EMAIL }}
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
jira_project: NTP
release_name: Android v${{ inputs.version_name }}
time_zone: Asia/Kolkata
release: false
archive: false