diff --git a/.github/workflows/cd-ios.yml b/.github/workflows/cd-ios.yml index efb504b4..826ceb2c 100644 --- a/.github/workflows/cd-ios.yml +++ b/.github/workflows/cd-ios.yml @@ -41,6 +41,12 @@ on: required: true appstore-private-key: required: true + discord_client_id: + required: true + api_host: + required: true + monitoring_key: + required: true jobs: publish-ios: runs-on: macos-15 @@ -68,8 +74,18 @@ jobs: # model: 'iPhone 16' # os_version: 18.2 - # This step might be obsolete at some point as .NET MAUI workloads - # are starting to come pre-installed on the GH Actions build agents. + # Build Environement variables + - name: Environement variables + run: | + chmod +x ./App/builds/ios_prebuild.sh + ./App/builds/ios_prebuild.sh + shell: bash + env: + discord_client_id: ${{ secrets.discord_client_id }} + api_host: ${{ secrets.api_host }} + monitoring_key: ${{ secrets.monitoring_key }} + project_folder: '.' + - name: Install MAUI Workload run: | dotnet workload install maui --ignore-failed-sources diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml index 28d97545..4100d65a 100644 --- a/.github/workflows/dev-deploy.yml +++ b/.github/workflows/dev-deploy.yml @@ -44,6 +44,9 @@ jobs: appstore-issuer: ${{ secrets.APPSTORE_ISSUER_ID }} appstore-keyid: ${{ secrets.APPSTORE_KEY_ID }} appstore-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }} + discord_client_id: ${{ secrets.DISCORD_CLIENT_ID }} + api_host: ${{ secrets.API_HOST }} + monitoring_key: ${{ secrets.MONITORING_KEY }} build-android: needs: setup uses: ./.github/workflows/cd-android.yml diff --git a/.github/workflows/pr-deploy.yml b/.github/workflows/pr-deploy.yml index a57e7349..4944f30b 100644 --- a/.github/workflows/pr-deploy.yml +++ b/.github/workflows/pr-deploy.yml @@ -45,6 +45,9 @@ jobs: appstore-issuer: ${{ secrets.APPSTORE_ISSUER_ID }} appstore-keyid: ${{ secrets.APPSTORE_KEY_ID }} appstore-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }} + discord_client_id: ${{ secrets.DISCORD_CLIENT_ID }} + api_host: ${{ secrets.API_HOST }} + monitoring_key: ${{ secrets.MONITORING_KEY }} build-android: needs: setup uses: ./.github/workflows/cd-android.yml diff --git a/.github/workflows/prod-deploy.yml b/.github/workflows/prod-deploy.yml index e00d4781..b4e7993b 100644 --- a/.github/workflows/prod-deploy.yml +++ b/.github/workflows/prod-deploy.yml @@ -44,6 +44,9 @@ jobs: appstore-issuer: ${{ secrets.APPSTORE_ISSUER_ID }} appstore-keyid: ${{ secrets.APPSTORE_KEY_ID }} appstore-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }} + discord_client_id: ${{ secrets.DISCORD_CLIENT_ID }} + api_host: ${{ secrets.API_HOST }} + monitoring_key: ${{ secrets.MONITORING_KEY }} build-android: needs: setup uses: ./.github/workflows/cd-android.yml diff --git a/App/builds/ios_prebuild.sh b/App/builds/ios_prebuild.sh new file mode 100644 index 00000000..66f813de --- /dev/null +++ b/App/builds/ios_prebuild.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +echo "Launching ios pre-build script" +if [ -z "$discord_client_id" ] +then + echo "You need define the discord_client_id variable in App Center" + exit +fi +if [ -z "$api_host" ] +then + echo "You need define the api_host variable in App Center" + exit +fi +if [ -z "$monitoring_key" ] +then + echo "You need define the monitoring_key variable in App Center" + exit +fi + +APP_CONSTANT_FILE=$project_folder/App/Core/AppConstant.cs + +if [ -e "$APP_CONSTANT_FILE" ] +then + echo "Updating AppConstant.cs" + echo "---" + echo "DiscordClientId = "$discord_client_id + sed -i '' 's#DiscordClientId = Environment.GetEnvironmentVariable("discord_client_id")#DiscordClientId = "'$discord_client_id'"#g' $APP_CONSTANT_FILE + echo "ApiHost = "$api_host + sed -i '' 's#ApiHost = Environment.GetEnvironmentVariable("api_host")#ApiHost = "'$api_host'"#g' $APP_CONSTANT_FILE + echo "MonitoringKey = "$monitoring_key + sed -i '' 's#MonitoringKey = Environment.GetEnvironmentVariable("monitoring_key")#MonitoringKey = "'$monitoring_key'"#g' $APP_CONSTANT_FILE + echo "File content:" + cat $APP_CONSTANT_FILE +else + echo "Incorrect file: "$APP_CONSTANT_FILE + exit +fi \ No newline at end of file