Skip to content

Commit

Permalink
Merge pull request #752 from gini/PP-74_Jira_comment
Browse files Browse the repository at this point in the history
Pp 74 jira comment
  • Loading branch information
zladzeyka authored Dec 13, 2024
2 parents 1effc32 + 2885438 commit c8084f7
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 26 deletions.
62 changes: 62 additions & 0 deletions .github/publish_to_firebase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -o pipefail

# Required since https://github.blog/2022-04-12-git-security-vulnerability-announced
git config --global --add safe.directory $GITHUB_WORKSPACE

RELEASE_NOTES=""
RELEASE_NOTES_FILE=""

TOKEN_DEPRECATED_WARNING_MESSAGE="⚠ This action will stop working with the next future major version of firebase-tools! Migrate to Service Account. See more: https://github.com/wzieba/Firebase-Distribution-Github-Action/wiki/FIREBASE_TOKEN-migration"

if [[ -z ${INPUT_RELEASENOTES} ]]; then
RELEASE_NOTES="$(git log -1 --pretty=short)"
else
RELEASE_NOTES=${INPUT_RELEASENOTES}
fi

if [[ ${INPUT_RELEASENOTESFILE} ]]; then
RELEASE_NOTES=""
RELEASE_NOTES_FILE=${INPUT_RELEASENOTESFILE}
fi

if [ -n "${INPUT_SERVICECREDENTIALSFILE}" ] ; then
export GOOGLE_APPLICATION_CREDENTIALS="${INPUT_SERVICECREDENTIALSFILE}"
fi

if [ -n "${INPUT_SERVICECREDENTIALSFILECONTENT}" ] ; then
cat <<< "${INPUT_SERVICECREDENTIALSFILECONTENT}" > service_credentials_content.json
export GOOGLE_APPLICATION_CREDENTIALS="service_credentials_content.json"
fi

if [ -n "${INPUT_TOKEN}" ] ; then
echo ${TOKEN_DEPRECATED_WARNING_MESSAGE}
export FIREBASE_TOKEN="${INPUT_TOKEN}"
fi

firebase \
appdistribution:distribute \
"$INPUT_FILE" \
--app "$INPUT_APPID" \
--groups "$INPUT_GROUPS" \
--testers "$INPUT_TESTERS" \
${RELEASE_NOTES:+ --release-notes "${RELEASE_NOTES}"} \
${INPUT_RELEASENOTESFILE:+ --release-notes-file "${RELEASE_NOTES_FILE}"} \
$( (( $INPUT_DEBUG )) && printf %s '--debug' ) |
{
while read -r line; do
echo $line

if [[ $line == *"View this release in the Firebase console"* ]]; then
CONSOLE_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//')
echo "FIREBASE_CONSOLE_URI=$CONSOLE_URI" >>"$GITHUB_OUTPUT"
elif [[ $line == *"Share this release with testers who have access"* ]]; then
TESTING_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//')
echo "TESTING_URI=$TESTING_URI" >>"$GITHUB_OUTPUT"
elif [[ $line == *"Download the release binary"* ]]; then
BINARY_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//')
echo "BINARY_DOWNLOAD_URI=$BINARY_URI" >>"$GITHUB_OUTPUT"
fi
done
}
50 changes: 42 additions & 8 deletions .github/workflows/bank-sdk.publish.example.app.firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,47 @@ jobs:
files: "*.ipa"
fail: true

- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20

- run: npm install -g [email protected]
shell: bash

- name: Distribute bank-sdk example ipa to Firebase App Distribution
uses: emertozd/Firebase-Distribution-Github-Action@v2
id: distribute
run: |
chmod +x .github/publish_to_firebase.sh
.github/publish_to_firebase.sh
shell: bash
env:
INPUT_APPID: ${{ secrets.GINI_BANK_SDK_EXAMPLE_APP_FIREBASE_ID }}
INPUT_SERVICECREDENTIALSFILECONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
INPUT_FILE: GiniBankSDKExample.ipa
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
- name: Extract Jira ticket
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | sed -n '2p')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: justin-jhg/gajira-login@v1
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_KEY }}

- name: Comment on issue
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: atlassian/gajira-comment@v3
with:
appId: ${{ secrets.GINI_BANK_SDK_EXAMPLE_APP_FIREBASE_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: GiniBankSDKExample.ipa
releaseNotes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
issue: ${{ env.JIRA_TICKET_NAME }}
comment: Build bank example app ${{ steps.distribute.outputs.FIREBASE_CONSOLE_URI }}
52 changes: 43 additions & 9 deletions .github/workflows/health-sdk.publish.example.apps.firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,48 @@ jobs:
with:
files: "*.ipa"
fail: true


- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20

- run: npm install -g [email protected]
shell: bash

- name: Distribute health-sdk example ipa to Firebase App Distribution
uses: emertozd/Firebase-Distribution-Github-Action@v2
id: distribute
run: |
chmod +x .github/publish_to_firebase.sh
.github/publish_to_firebase.sh
shell: bash
env:
INPUT_APPID: ${{ secrets.GINI_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID }}
INPUT_SERVICECREDENTIALSFILECONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
INPUT_FILE: GiniHealthSDKExample.ipa
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
- name: Extract Jira ticket
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | sed -n '2p')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: justin-jhg/gajira-login@v1
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_KEY }}

- name: Comment on issue
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: atlassian/gajira-comment@v3
with:
appId: ${{ secrets.GINI_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: GiniHealthSDKExample.ipa
releaseNotes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
issue: ${{ env.JIRA_TICKET_NAME }}
comment: Build health example app ${{ steps.distribute.outputs.FIREBASE_CONSOLE_URI }}
53 changes: 44 additions & 9 deletions .github/workflows/merchant-sdk.publish.example.apps.firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,51 @@ jobs:
files: "*.ipa"
fail: true

- name: Distribute merchant-sdk example ipa to Firebase App Distribution
uses: emertozd/Firebase-Distribution-Github-Action@v2
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
appId: ${{ secrets.GINI_MERCHANT_SDK_EXAMPLE_APP_FIREBASE_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: GiniMerchantSDKExample.ipa
releaseNotes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
node-version: 20

- run: npm install -g [email protected]
shell: bash

- name: Distribute Merchant sdk example apk to Firebase App Distribution
id: distribute
run: |
chmod +x .github/publish_to_firebase.sh
.github/publish_to_firebase.sh
shell: bash
env:
INPUT_APPID: ${{ secrets.GINI_MERCHANT_SDK_EXAMPLE_APP_FIREBASE_ID }}
INPUT_SERVICECREDENTIALSFILECONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
INPUT_FILE: GiniMerchantSDKExample.ipa
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
- name: Extract Jira ticket
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | sed -n '2p')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: justin-jhg/gajira-login@v1
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_KEY }}

- name: Comment on issue
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: atlassian/gajira-comment@v3
with:
issue: ${{ env.JIRA_TICKET_NAME }}
comment: Build merchant example app ${{ steps.distribute.outputs.FIREBASE_CONSOLE_URI }}




0 comments on commit c8084f7

Please sign in to comment.