Skip to content

Commit

Permalink
deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilmintacpineda committed Mar 17, 2021
1 parent 1cecadb commit c68bbe2
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 42 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/android-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: false
env:
STAGE: "prod"
API_BASE_URL: "https://apiv1.entrepic.com"
NODE_ENV: "production"

# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down Expand Up @@ -55,12 +53,15 @@ jobs:
- name: Setup files
run: |
echo '${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}' > android/google-service-account-key.json
echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
echo '${{ secrets.GOOGLE_SERVICES_JSON_PROD }}' > android/app/google-services.json
echo "${{ secrets.ANDROID_SIGNING_KEY }}" > my-upload-key.keystore.asc
gpg -d --passphrase "${{ secrets.ANDROID_SIGNING_KEY_PASSPHRASE }}" --batch my-upload-key.keystore.asc > android/app/my-upload-key.keystore
- name: Build and deploy
run: |
cp src/env.example.js > src/env.js
yarn replacer -f src/env.js -p __STAGE__ -r "prod"
yarn replacer -f src/env.js -p __API_BASE_URL__ -r "https://apiv1.entrepic.com"
yarn replacer -f android/gradle.properties -p __KEYSTOR_PASSWORD__ -r "${{ secrets.KEYSTORE_PASSWORD }}"
cd android
bundle exec fastlane android internal
7 changes: 4 additions & 3 deletions .github/workflows/dev-android-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: false
env:
STAGE: "dev"
API_BASE_URL: "https://apiv1dev.entrepic.com"
NODE_ENV: "production"

# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down Expand Up @@ -55,12 +53,15 @@ jobs:
- name: Setup files
run: |
echo '${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}' > android/google-service-account-key.json
echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
echo '${{ secrets.GOOGLE_SERVICES_JSON_DEV }}' > android/app/google-services.json
echo "${{ secrets.ANDROID_SIGNING_KEY }}" > my-upload-key.keystore.asc
gpg -d --passphrase "${{ secrets.ANDROID_SIGNING_KEY_PASSPHRASE }}" --batch my-upload-key.keystore.asc > android/app/my-upload-key.keystore
- name: Build and deploy
run: |
cp src/env.example.js > src/env.js
yarn replacer -f src/env.js -p __STAGE__ -r "prod"
yarn replacer -f src/env.js -p __API_BASE_URL__ -r "https://apiv1dev.entrepic.com"
yarn replacer -f android/gradle.properties -p __KEYSTOR_PASSWORD__ -r "${{ secrets.KEYSTORE_PASSWORD }}"
cd android
bundle exec fastlane android internal
6 changes: 3 additions & 3 deletions .github/workflows/dev-ios-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
runs-on: macos-latest
continue-on-error: false
env:
STAGE: "dev"
API_BASE_URL: "https://apiv1dev.entrepic.com"
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
Expand Down Expand Up @@ -76,12 +74,14 @@ jobs:
- name: Bundle mainjs
run: |
cp src/env.example.js > src/env.js
yarn replacer -f src/env.js -p __STAGE__ -r "dev"
yarn replacer -f src/env.js -p __API_BASE_URL__ -r "https://apiv1dev.entrepic.com"
yarn bundle-js
- name: Setup files
run: |
echo "${{ secrets.P8_AUTH_KEY }}" > FastlaneDeploymentCI.p8
echo "${{ secrets.GOOGLE_SERVICES_PLIST }}" > ios/proj_pronetplat_aa/GoogleService-Info.plist
echo "${{ secrets.GOOGLE_SERVICES_PLIST_DEV }}" > ios/proj_pronetplat_aa/GoogleService-Info.plist
- name: Build and deploy
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ios-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ jobs:
- name: Bundle mainjs
run: |
cp src/env.example.js > src/env.js
yarn replacer -f src/env.js -p __STAGE__ -r "prod"
yarn replacer -f src/env.js -p __API_BASE_URL__ -r "https://apiv1dev.entrepic.com"
yarn bundle-js
- name: Setup files
run: |
echo "${{ secrets.P8_AUTH_KEY }}" > FastlaneDeploymentCI.p8
echo "${{ secrets.GOOGLE_SERVICES_PLIST }}" > ios/proj_pronetplat_aa/GoogleService-Info.plist
echo "${{ secrets.GOOGLE_SERVICES_PLIST_PROD }}" > ios/proj_pronetplat_aa/GoogleService-Info.plist
- name: Build and deploy
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ buck-out/
*/fastlane/screenshots
service-account.json
*.keystore.*
FastlaneDeploymentCI.p8
*.p8
vendor/

# Bundle artifact
Expand Down
4 changes: 2 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro

MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=password
MYAPP_UPLOAD_KEY_PASSWORD=password
MYAPP_UPLOAD_STORE_PASSWORD=__KEYSTORE_PASSWORD__
MYAPP_UPLOAD_KEY_PASSWORD=__KEYSTORE_PASSWORD__
17 changes: 1 addition & 16 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,7 @@ const plugins = [
if (process.env.NODE_ENV === 'production') {
plugins.push(
'react-native-paper/babel', // react-native-paper
'transform-remove-console',
[
'search-and-replace',
{
rules: [
{
search: /__STAGE__/gm,
replace: process.env.STAGE
},
{
search: /__API_BASE_URL__/gm,
replace: process.env.API_BASE_URL
}
]
}
]
'transform-remove-console'
);
}

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"bootsplash": "react-native generate-bootsplash assets/bootsplash_logo_original.png --background-color=28003A --logo-width=150",
"patch-packages": "patch-package react-native-paper react-native-push-notification-popup rn-placeholder",
"bundle-js": "react-native bundle --entry-file index.js --bundle-output ios/main.jsbundle",
"postversion": "react-native-version"
"postversion": "react-native-version",
"replacer": "node scripts/replacer.js"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.14.1",
Expand Down Expand Up @@ -67,8 +68,8 @@
"babel-jest": "^26.6.3",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-optional-require": "^0.3.1",
"babel-plugin-search-and-replace": "^1.1.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"command-line-args": "^5.1.1",
"eslint": "^7.22.0",
"eslint-import-resolver-babel-module": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
Expand Down
6 changes: 0 additions & 6 deletions resources/Apple/development/AuthKey_A57XW2494S.p8

This file was deleted.

20 changes: 20 additions & 0 deletions scripts/replacer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require('fs').promises;
const path = require('path');
const cmdArgs = require('command-line-args');

(async () => {
const optionDefinitions = [
{ name: 'file', alias: 'f', type: String },
{ name: 'placeholder', alias: 'p', type: String },
{ name: 'replacement', alias: 'r', type: String }
];

const { file, placeholder, replacement } = cmdArgs(
optionDefinitions
);

const filePath = path.join(__dirname, '../', file);
let fileContent = await fs.readFile(filePath, 'utf-8');
fileContent = fileContent.replaceAll(placeholder, replacement);
await fs.writeFile(filePath, fileContent);
})();
37 changes: 32 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2982,6 +2982,11 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=

array-back@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0"
integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==

array-filter@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83"
Expand Down Expand Up @@ -3186,11 +3191,6 @@ babel-plugin-optional-require@^0.3.1:
is-builtin-module "^2.0.0"
resolve-from "^4.0.0"

babel-plugin-search-and-replace@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-search-and-replace/-/babel-plugin-search-and-replace-1.1.0.tgz#ad26f2037a80034613dae61b913902d9aa58ed2c"
integrity sha512-qo3E08GmT43/IgfbEiAZoauYW3SILLTyt79QPZc2ME3sHvuBuRA01nQl7WnJRKZTnqUCimXSMOU+LBHxe+HTUw==

babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0:
version "7.0.0-beta.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf"
Expand Down Expand Up @@ -3729,6 +3729,16 @@ command-exists@^1.2.8:
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69"
integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==

command-line-args@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.1.1.tgz#88e793e5bb3ceb30754a86863f0401ac92fd369a"
integrity sha512-hL/eG8lrll1Qy1ezvkant+trihbGnaKaeEjj6Scyr3DN+RC7iQ5Rz84IeLERfAWDGo0HBSNAakczwgCilDXnWg==
dependencies:
array-back "^3.0.1"
find-replace "^3.0.0"
lodash.camelcase "^4.3.0"
typical "^4.0.0"

commander@^2.19.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
Expand Down Expand Up @@ -5002,6 +5012,13 @@ find-cache-dir@^2.0.0:
make-dir "^2.0.0"
pkg-dir "^3.0.0"

find-replace@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38"
integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==
dependencies:
array-back "^3.0.1"

find-up@^2.0.0, find-up@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
Expand Down Expand Up @@ -6794,6 +6811,11 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=

lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=

lodash.flattendeep@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"
Expand Down Expand Up @@ -9930,6 +9952,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typical@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4"
integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==

ua-parser-js@^0.7.18:
version "0.7.23"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.23.tgz#704d67f951e13195fbcd3d78818577f5bc1d547b"
Expand Down

0 comments on commit c68bbe2

Please sign in to comment.