Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pp 74 jira ticket post #635

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
7 changes: 0 additions & 7 deletions .github/workflows/bank-sdk.publish.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ name: Publish Bank SDK Example App QA Build to App Center

on:
workflow_dispatch:
push:
paths:
- 'bank-sdk/**'
- 'capture-sdk/**'
- 'bank-api-library/**'
- 'core-api-library/**'
- 'gradle/**'

jobs:
check:
Expand Down
50 changes: 42 additions & 8 deletions .github/workflows/bank-sdk.publish.firebase.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,47 @@ jobs:
files: "./bank-sdk/example-app/build/outputs/apk/qaExampleApp/release/example-app-qa-exampleApp-release.apk"
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 apk 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: bank-sdk/example-app/build/outputs/apk/qaExampleApp/release/example-app-qa-exampleApp-release.apk
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: bank-sdk/example-app/build/outputs/apk/qaExampleApp/release/example-app-qa-exampleApp-release.apk
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 }}
6 changes: 0 additions & 6 deletions .github/workflows/health-sdk.publish.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: Publish Health SDK Example App QA Build to App Center

on:
workflow_dispatch:
push:
paths:
- 'health-sdk/**'
- 'health-api-library/**'
- 'core-api-library/**'
- 'gradle/**'

jobs:
check:
Expand Down
52 changes: 43 additions & 9 deletions .github/workflows/health-sdk.publish.firebase.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
GINI_MOBILE_TEST_CLIENT_SECRET: ${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}
HEALTH_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD: ${{ secrets.HEALTH_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}

publish_to_app_center:
publish_to_firebase_distribution:
needs: check
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -52,13 +52,47 @@ jobs:
files: "./health-sdk/example-app/build/outputs/apk/qa/release/example-app-qa-release.apk"
fail: true

- name: Distribute Health-sdk example apk 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_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID}}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: health-sdk/example-app/build/outputs/apk/qa/release/example-app-qa-release.apk
releaseNotes: |
node-version: 20

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

- name: Distribute Health-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_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID}}
INPUT_SERVICECREDENTIALSFILECONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
INPUT_FILE: health-sdk/example-app/build/outputs/apk/qa/release/example-app-qa-release.apk
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
${{ 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 health example app ${{ steps.distribute.outputs.FIREBASE_CONSOLE_URI }}
6 changes: 0 additions & 6 deletions .github/workflows/merchant-sdk.publish.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: Publish Merchant SDK Example App QA Build to App Center

on:
workflow_dispatch:
push:
paths:
- 'merchant-sdk/**'
- 'health-api-library/**'
- 'core-api-library/**'
- 'gradle/**'

jobs:
check:
Expand Down
54 changes: 44 additions & 10 deletions .github/workflows/merchant-sdk.publish.firebase.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
secrets:
GINI_MOBILE_TEST_CLIENT_SECRET: ${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}
MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD: ${{ secrets.MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}
publish_to_app_center:

publish_to_firebase_distribution:
needs: check
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -52,13 +52,47 @@ jobs:
files: "./merchant-sdk/example-app/build/outputs/apk/qa/release/example-app-qa-release.apk"
fail: true

- name: Distribute Merchant sdk example apk 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: merchant-sdk/example-app/build/outputs/apk/qa/release/example-app-qa-release.apk
releaseNotes: |
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: merchant-sdk/example-app/build/outputs/apk/qa/release/example-app-qa-release.apk
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
${{ 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 }}