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

feat: check cicd vars #1629

Merged
merged 7 commits into from
Nov 28, 2023
Merged
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
68 changes: 44 additions & 24 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,56 @@ on:
- .yarn/**

jobs:
check-android-secrets:
check-secrets:
runs-on: ubuntu-22.04
outputs:
isReleaseBuild: ${{ steps.isReleaseBuild.outputs.defined }}
steps:
- id: isReleaseBuild
if: env.PLAY_STORE_JKS_BASE64 != null && env.PLAY_STORE_JKS_ALIAS != null && env.PLAY_STORE_JKS_PASSWD != null
run: echo "::set-output name=defined::true"
- name: Check secrets
shell: bash
run: |
required_env_vars=(
"CERTIFICATE"
"KEYCHIAN_PASSWD"
"PROVISIONING_PROFILE"
"PLAY_STORE_JKS_BASE64"
"PLAY_STORE_JKS_ALIAS"
"PLAY_STORE_JKS_PASSWD"
)
for var in "${required_env_vars[@]}"; do
if [ -z "${!var}" ]; then
echo "error: $var is not set."
exit 1
fi
done
env:
CERTIFICATE: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
KEYCHIAN_PASSWD: ${{ secrets.KEYCHIAN_PASSWD }}
PROVISIONING_PROFILE: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
PLAY_STORE_JKS_BASE64: ${{ secrets.PLAY_STORE_JKS_BASE64 }}
PLAY_STORE_JKS_ALIAS: ${{ secrets.PLAY_STORE_JKS_ALIAS }}
PLAY_STORE_JKS_PASSWD: ${{ secrets.PLAY_STORE_JKS_PASSWD }}

check-ios-secrets:
check-vars:
runs-on: ubuntu-22.04
outputs:
isReleaseBuild: ${{ steps.isReleaseBuild.outputs.defined }}
steps:
- id: isReleaseBuild
if: env.CERTIFICATE != null && env.KEYCHIAN_PASSWD != null && env.PROVISIONING_PROFILE != null
run: echo "::set-output name=defined::true"
- name: Check variables
shell: bash
run: |
required_env_vars=(
"OCA_URL"
"PROOF_TEMPLATE_URL"
)
for var in "${required_env_vars[@]}"; do
if [ -z "${!var}" ]; then
echo "error: $var is not set."
exit 1
fi
done
env:
CERTIFICATE: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
KEYCHIAN_PASSWD: ${{ secrets.KEYCHIAN_PASSWD }}
PROVISIONING_PROFILE: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
OCA_URL: ${{ vars.OCA_URL }}
PROOF_TEMPLATE_URL: ${{ vars.PROOF_TEMPLATE_URL }}

build-ios:
needs: [check-ios-secrets]
needs: [check-secrets, check-vars]
runs-on: macos-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/app/Gemfile
Expand All @@ -67,7 +89,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: "3.11"

- name: Setup NodeJS
uses: ./.github/workflows/actions/setup-node
Expand Down Expand Up @@ -139,21 +161,20 @@ jobs:
# Actual environment variables are not being picked up
# by the build so they're put into an .env file.
- name: Create environment settings
if: env.MEDIATOR_URL != null && env.IAS_PORTAL_URL != null && env.IAS_AGENT_INVITE_URL != null && env.OCA_URL != null && env.PROOF_TEMPLATE_URL != null
working-directory: app
env:
MEDIATOR_USE_PUSH_NOTIFICATIONS: false
MEDIATOR_URL: ${{ secrets.MEDIATOR_URL }}
IAS_PORTAL_URL: ${{ secrets.IAS_PORTAL_URL }}
IAS_AGENT_INVITE_URL: ${{ secrets.IAS_AGENT_INVITE_URL }}
OCA_URL: ${{ vars.OCA_URL }}
MEDIATOR_USE_PUSH_NOTIFICATIONS: false
PROOF_TEMPLATE_URL: ${{ vars.PROOF_TEMPLATE_URL }}
run: |
echo "MEDIATOR_URL=${MEDIATOR_URL}" >.env
echo "MEDIATOR_USE_PUSH_NOTIFICATIONS=${MEDIATOR_USE_PUSH_NOTIFICATIONS}" >.env
echo "MEDIATOR_URL=${MEDIATOR_URL}" >>.env
echo "IAS_PORTAL_URL=${IAS_PORTAL_URL}" >>.env
echo "IAS_AGENT_INVITE_URL=${IAS_AGENT_INVITE_URL}" >>.env
echo "OCA_URL=${OCA_URL}" >>.env
echo "MEDIATOR_USE_PUSH_NOTIFICATIONS=${MEDIATOR_USE_PUSH_NOTIFICATIONS}" >>.env
echo "PROOF_TEMPLATE_URL=${PROOF_TEMPLATE_URL}" >>.env

- name: Archive build
Expand Down Expand Up @@ -241,7 +262,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}

build-android:
needs: [check-android-secrets]
needs: [check-secrets, check-vars]
runs-on: ubuntu-22.04
permissions:
contents: read
Expand All @@ -255,7 +276,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: "3.11"

- name: Setup NodeJS
uses: ./.github/workflows/actions/setup-node
Expand All @@ -281,7 +302,6 @@ jobs:
# Actual environment variables are not being picked up
# by the build so they're put into an .env file.
- name: Create environment settings
if: env.MEDIATOR_URL != null && env.IAS_PORTAL_URL != null && env.IAS_AGENT_INVITE_URL != null && env.OCA_URL != null && env.PROOF_TEMPLATE_URL != null
working-directory: app
env:
MEDIATOR_URL: ${{ secrets.MEDIATOR_URL }}
Expand Down
Loading