generated from IDEMSInternational/app-sample-content
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 74362cc
Showing
186 changed files
with
36,074 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
#Upload Translations to crowdin | ||
#Get content repo | ||
#Get Translations repo | ||
#Get Translation content repo | ||
# run script to post translations | ||
|
||
|
||
|
||
|
||
#Download Translations from crowdin | ||
#Get content repo | ||
#Get Translations repo | ||
#Get Translation content repo | ||
# run script to get translations | ||
# move and rename translation files | ||
|
||
#File expecting : es_dictionary.json | ||
#move to : translated.mx_es.json | ||
|
||
# build and commit changes. | ||
|
||
|
||
################################################################################## | ||
# About | ||
################################################################################## | ||
# Get translations from crowdin | ||
# | ||
# Version : 1.0 | ||
# | ||
################################################################################## | ||
# Configuration | ||
################################################################################## | ||
env: | ||
DEPLOYMENT_NAME: ${{vars.DEPLOYMENT_NAME}} | ||
APP_CODE_BRANCH: ${{vars.APP_CODE_BRANCH}} | ||
PARENT_DEPLOYMENT_REPO: ${{vars.PARENT_DEPLOYMENT_REPO}} | ||
PARENT_DEPLOYMENT_NAME: ${{vars.PARENT_DEPLOYMENT_NAME}} | ||
PARENT_DEPLOYMENT_BRANCH: ${{vars.PARENT_DEPLOYMENT_BRANCH}} | ||
DEPLOYMENT_PRIVATE_KEY: ${{secrets.DEPLOYMENT_PRIVATE_KEY}} | ||
FIREBASE_CONFIG: ${{secrets.FIREBASE_CONFIG}} | ||
GDRIVE_CREDENTIALS: ${{ secrets.GDRIVE_CREDENTIALS }} | ||
GDRIVE_TOKEN: ${{ secrets.GDRIVE_TOKEN }} | ||
|
||
|
||
name: Update Translations, sync and create a PR | ||
################################################################################## | ||
# Main Code | ||
################################################################################## | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr-title: | ||
description: Title for PR | ||
type: string | ||
default: Translation sync from actions | ||
pr-body: | ||
description: Description for PR | ||
type: string | ||
default: Automated Translation PR creation from actions | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check translation repo #TODO this repo should be a variable | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: "IDEMSInternational/plh-digital-content.git" | ||
path: "plh-digital-content" | ||
ref: "main" | ||
|
||
- name: Check idems_translation | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: "IDEMSInternational/idems_translation.git" | ||
path: "idems_translation" | ||
ref: "master" | ||
|
||
- name: set up python enviroment | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: update idems_translation packages | ||
working-directory: idems_translation | ||
run: | ||
npm ci || true | ||
|
||
- name: List contents of current directory | ||
run: ls -l | ||
|
||
- name: Check out app code | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: "IDEMSInternational/parenting-app-ui.git" | ||
ref: ${{env.APP_CODE_BRANCH}} | ||
path: "parenting-app-ui" | ||
|
||
- name: List contents of current directory | ||
run: ls -l | ||
|
||
- name: Remove .git from the repository in order to nest | ||
working-directory: parenting-app-ui | ||
run: | | ||
rm -rf .git | ||
- name: Checkout parent repo if needed | ||
if: env.PARENT_DEPLOYMENT_REPO != '' | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "parenting-app-ui/.idems_app/deployments/${{env.PARENT_DEPLOYMENT_NAME}}" | ||
repository: ${{env.PARENT_DEPLOYMENT_REPO}} | ||
ref: ${{env.PARENT_DEPLOYMENT_BRANCH}} | ||
|
||
- name: Checkout deployment | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
path: "parenting-app-ui/.idems_app/deployments/${{env.DEPLOYMENT_NAME}}" | ||
|
||
- name: List contents of current directory | ||
run: ls -l | ||
|
||
|
||
|
||
- name: Run script to create translation files | ||
working-directory: idems_translation | ||
run: python app/scripts/merge_files_post_translation.py ../parenting-app-ui/.idems_app/deployments/${{env.DEPLOYMENT_NAME}}/translator_settings.json | ||
|
||
|
||
- name: Move and rename translation file | ||
run: | | ||
LANGUAGES=$(cat parenting-app-ui/.idems_app/deployments/${{env.DEPLOYMENT_NAME}}/language_mappings.json) | ||
# Loop through languages and move files | ||
for lang in $(echo "${LANGUAGES}" | jq -r 'keys[]'); do | ||
destination=$(echo "${LANGUAGES}" | jq -r ".[\"$lang\"]") | ||
mv idems_translation/app/5_completed_dictionaries/${lang}_dictionary.json parenting-app-ui/.idems_app/deployments/${{env.DEPLOYMENT_NAME}}/translations_source/translated_strings/translated.${destination}.json | ||
done | ||
- name: Populate Encryption key | ||
if: env.DEPLOYMENT_PRIVATE_KEY != '' | ||
working-directory: parenting-app-ui | ||
run: echo "${{env.DEPLOYMENT_PRIVATE_KEY}}" > ./.idems_app/deployments/${{env.DEPLOYMENT_NAME}}/encrypted/private.key | ||
|
||
# TODO - populate firebase as part of deployment set | ||
- name: Populate Firebase Config | ||
if: env.FIREBASE_CONFIG != '' | ||
working-directory: parenting-app-ui | ||
run: echo 'export const firebaseConfig = ${{env.FIREBASE_CONFIG}}' > src/environments/firebaseConfig.ts | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./parenting-app-ui/.yarn/cache | ||
# If cachebusting required (e.g. breaking yarn changes on update) change `v1` to another number | ||
key: ${{ runner.os }}-node-modules-yarn-v1-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules-yarn-v1- | ||
- name: Install node modules | ||
working-directory: parenting-app-ui | ||
run: yarn install | ||
|
||
- name: Set deployment | ||
working-directory: parenting-app-ui | ||
run: yarn workflow deployment set $DEPLOYMENT_NAME | ||
|
||
- name: Add google credentials | ||
working-directory: parenting-app-ui | ||
run: echo "${{env.GDRIVE_CREDENTIALS}}" > ./packages/scripts/config/credentials.json | ||
|
||
- name: Add google token | ||
working-directory: parenting-app-ui | ||
run: echo "$GDRIVE_TOKEN" > ./packages/scripts/config/token.json | ||
env: | ||
GDRIVE_TOKEN: ${{ env.GDRIVE_TOKEN }} | ||
|
||
- name: Sync content | ||
working-directory: parenting-app-ui | ||
run: yarn workflow sync | ||
|
||
- name: Increment version number | ||
working-directory: parenting-app-ui | ||
run: | | ||
# Define the path to the file | ||
FILE_PATH="./.idems_app/deployments/${{env.DEPLOYMENT_NAME}}/config.ts" | ||
# Extract the version number | ||
VERSION=$(grep 'content_tag_latest:' $FILE_PATH | sed 's/content_tag_latest: *"\(.*\)",/\1/') | ||
echo "Extracted Version: $VERSION" | ||
# Split the version into major, minor, and patch components | ||
IFS='.' read -ra VERSION_PARTS <<< "$VERSION" | ||
|
||
if [[ ${#VERSION_PARTS[@]} -ne 3 ]]; then | ||
echo "Error: Version format is not as expected." | ||
exit 1 | ||
fi | ||
|
||
PATCH_VERSION="${VERSION_PARTS[2]}" | ||
|
||
# Increment the patch version | ||
NEW_PATCH_VERSION=$((PATCH_VERSION + 1)) | ||
|
||
# Construct the new version | ||
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$NEW_PATCH_VERSION" | ||
|
||
echo "New Version: $NEW_VERSION" | ||
echo "Command: s/$VERSION/$NEW_VERSION/ $FILE_PATH" | ||
|
||
sed -i 's/\(content_tag_latest: "\)\([0-9]\+\.[0-9]\+\.\)\([0-9]\+\)"/\1\2'$((NEW_PATCH_VERSION))'"/' $FILE_PATH | ||
|
||
- name: Commit changes | ||
working-directory: parenting-app-ui/.idems_app/deployments/${{env.DEPLOYMENT_NAME}} | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add . # This adds all changes to the staging area | ||
git diff --quiet && git diff --staged --quiet || git commit -m "Automated commit message" # Only commit if there are changes | ||
# git checkout -b automated-changes | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
with: | ||
token: ${{ secrets.PAT }} | ||
# Relative path under $GITHUB_WORKSPACE to the repository. Defaults to $GITHUB_WORKSPACE. | ||
path: parenting-app-ui/.idems_app/deployments/${{env.DEPLOYMENT_NAME}} | ||
# The title of the pull request. | ||
title: ${{ inputs.pr-title }} | ||
# The body of the pull request. | ||
body: ${{ inputs.pr-body }} | ||
labels: test - preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Android - Release to Google Play | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
android_release: | ||
uses: IDEMSInternational/open-app-builder/.github/workflows/reusable-android-release.yml@master | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Perform content sync and create a PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr-title: | ||
description: Title for PR | ||
type: string | ||
default: sync content from google sheets | ||
pr-body: | ||
description: Description for PR | ||
type: string | ||
default: Automated PR creation from actions | ||
jobs: | ||
sync_content: | ||
uses: IDEMSInternational/open-app-builder/.github/workflows/reusable-content-sync.yml@master | ||
with: | ||
pr-title: ${{ inputs.pr-title }} | ||
pr-body: ${{ inputs.pr-body }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Deploy - Firebase | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
web_preview: | ||
uses: IDEMSInternational/open-app-builder/.github/workflows/reusable-deploy-web-preview.yml@master | ||
secrets: inherit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
name: Deployment Preview | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, synchronize] | ||
|
||
jobs: | ||
pr_preview: | ||
uses: IDEMSInternational/open-app-builder/.github/workflows/reusable-deploy-pr-preview.yml@master | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
################################################################################## | ||
# Calls workflow from code repo | ||
################################################################################## | ||
env: | ||
FIREBASE_SERVICE_ACCOUNT: ${{secrets.FIREBASE_SERVICE_ACCOUNT}} | ||
FIREBASE_CONFIG_RELEASE: ${{secrets.FIREBASE_CONFIG_RELEASE}} | ||
|
||
name: Firebase - release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
web_preview: | ||
uses: IDEMSInternational/open-app-builder/.github/workflows/reusable-deploy-web-preview.yml@master | ||
with: | ||
firebase-host: ${{vars.FIREBASE_HOSTING_TARGET_RELEASE}} | ||
secrets: inherit | ||
|
Oops, something went wrong.