-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
5 changed files
with
181 additions
and
1 deletion.
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,97 @@ | ||
name: RTMIS Build and Deploy Prod | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_and_deploy_jobs: | ||
name: RTMIS Build and Deploy Jobs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set short git commit SHA | ||
id: vars | ||
run: | | ||
shortSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "COMMIT_SHORT_SHA=$shortSha" >> $GITHUB_ENV | ||
- name: Docker compose rebuild | ||
uses: ./.github/composite-actions/ssh-docker-compose | ||
with: | ||
server-ip: ${{ secrets.SERVER_IP }} | ||
server-ssh-port: ${{ secrets.SERVER_SSH_PORT }} | ||
server-ssh-secret-key: ${{ secrets.SERVER_SSH_SECRET_KEY }} | ||
server-ssh-user: ${{ secrets.SERVER_SSH_USER }} | ||
docker-compose-file: ${{ secrets.DOCKER_COMPOSE_FILE }} | ||
docker-compose-file-frontend-build: ${{ secrets.DOCKER_COMPOSE_FILE_FRONTEND_BUILD }} | ||
ci_commit: ${{ env.COMMIT_SHORT_SHA }} | ||
|
||
mobile-app-release: | ||
name: Mobile App Build | ||
needs: build_and_deploy_jobs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🗄️ Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🧰 Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: 🏗 Setup EAS | ||
uses: expo/expo-github-action@v8 | ||
with: | ||
eas-version: latest | ||
token: ${{ secrets.EXPO_TOKEN }} | ||
|
||
- name: 📦 Install dependencies | ||
run: | | ||
cd ./app/ | ||
cp ./src/build.prod.js ./src/build.js | ||
npm install | ||
- name: 🚀 Release to Expo Dev | ||
id: eas_release | ||
working-directory: ./app | ||
run: | | ||
npm run eas:release > output.txt | ||
cat output.txt | ||
echo "APK_URL=$(tail -n 1 output.txt)" >> $GITHUB_ENV | ||
- name: Set short git commit SHA | ||
id: vars | ||
run: | | ||
shortSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "COMMIT_SHORT_SHA=$shortSha" >> $GITHUB_ENV | ||
- name: Get App Version | ||
id: get_version | ||
run: | | ||
cd app | ||
apk_version=$(grep '"version":' package.json | sed -E 's/.*"version": *"([^"]+)".*/\1/') | ||
echo "APK_VERSION=$apk_version" >> $GITHUB_ENV | ||
- name: 🌟 Send APK | ||
env: | ||
APK_VERSION: ${{ env.APK_VERSION }} | ||
SECRET: ${{ secrets.APK_UPLOAD_SECRET }} | ||
SENTRY_ENV: production | ||
SENTRY_DSN: ${{ secrets.SENTRY_MOBILE_DSN }} | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_MOBILE_AUTH_TOKEN }} | ||
run: | | ||
curl -X 'POST' \ | ||
'https://rtmis.akvo.org/api/v1/device/apk/upload' \ | ||
-H 'accept: */*' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"apk_url": "'"$APK_URL"'", | ||
"apk_version": "'"$APK_VERSION"'", | ||
"secret": "'"$SECRET"'" | ||
}' |
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,9 @@ | ||
import buildJson from './build.json'; | ||
|
||
const defaultBuildParams = { | ||
...buildJson, | ||
serverURL: 'https://rtmis.akvo.org/api/v1/device', | ||
apkURL: 'https://rtmis.akvo.org/app', | ||
}; | ||
|
||
export default defaultBuildParams; |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
00 23 * * * cat /proc/1/environ | tr '\0' '\n' > /etc/environment | ||
01 23 * * * date >> /app/cron.log && cd /app/ && bash -l ./job.sh >> /app/cron.log 2>&1 | ||
01 23 * * * date >> /app/cron.log && cd /app/ && bash -l ./job.sh >> /app/cron.log 2>&1 | ||
|
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,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Seed Administration? [y/n]" | ||
read -r seed_administration | ||
if [[ "${seed_administration}" == 'y' || "${seed_administration}" == 'Y' ]]; then | ||
python manage.py administration_seeder | ||
python manage.py resetsequence v1_profile | ||
fi | ||
|
||
echo "Add New Super Admin? [y/n]" | ||
read -r add_account | ||
if [[ "${add_account}" == 'y' || "${add_account}" == 'Y' ]]; then | ||
echo "Please type email address" | ||
read -r email_address | ||
if [[ "${email_address}" != '' ]]; then | ||
python manage.py createsuperuser --email "${email_address}" | ||
python manage.py assign_access "${email_address}" | ||
fi | ||
fi | ||
|
||
echo "Seed Fake User? [y/n]" | ||
read -r fake_user | ||
if [[ "${fake_user}" == 'y' || "${fake_user}" == 'Y' ]]; then | ||
echo "Creating User for Admin with email admin@akvo.org" | ||
python manage.py createsuperuser \ | ||
--email admin@akvo.org --first_name Admin --last_name One | ||
python manage.py assign_access admin@akvo.org --admin | ||
# python manage.py fake_user_seeder --repeat 50 | ||
fi | ||
|
||
echo "Seed Form? [y/n]" | ||
read -r seed_form | ||
if [[ "${seed_form}" == 'y' || "${seed_form}" == 'Y' ]]; then | ||
python manage.py form_seeder | ||
python manage.py generate_config | ||
fi | ||
|
||
echo "Seed Fake Data? [y/n]" | ||
read -r seed_fake_data | ||
if [[ "${seed_fake_data}" == 'y' || "${seed_fake_data}" == 'Y' ]]; then | ||
python manage.py fake_data_seeder | ||
fi | ||
|
||
echo "Seed Fake Data Claim? [y/n]" | ||
read -r seed_fake_data_claim | ||
if [[ "${seed_fake_data_claim}" == 'y' || "${seed_fake_data_claim}" == 'Y' ]]; then | ||
python manage.py fake_data_claim_seeder | ||
fi | ||
|
||
echo "Seed Organisation? [y/n]" | ||
read -r seed_organization | ||
if [[ "${seed_organization}" == 'y' || "${seed_organization}" == 'Y' ]]; then | ||
python manage.py organisation_seeder | ||
fi | ||
|
||
echo "Seed Entities? [y/n]" | ||
read -r seed_entities | ||
if [[ "${seed_entities}" == 'y' || "${seed_entities}" == 'Y' ]]; then | ||
python manage.py entities_seeder | ||
fi | ||
|
||
echo "Seed Administration Attribute? [y/n]" | ||
read -r seed_administration_attribute | ||
if [[ "${seed_administration_attribute}" == 'y' || "${seed_administration_attribute}" == 'Y' ]]; then | ||
python manage.py administration_attribute_seeder | ||
fi | ||
|
||
python manage.py generate_sqlite | ||
|
||
# python manage.py fake_approver_seeder | ||
# python manage.py fake_data_seeder |
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