Skip to content

Commit bad3325

Browse files
chore: simplify CI/CD env file handling (#311)
* chore: simplify CI/CD env file handling - Use single .env file per project instead of variant-specific files - Move SENTRY_TAG to misc_*.ts files for build variant metadata - Remove env file copying from iOS Xcode schemes (keep only misc.ts copy) - Simplify Android build.gradle to use single .env file - Update GitHub workflows to use env-file secret/variable - Remove ENV_RELAY_URL (library has default value) - Update READMEs with clearer setup instructions This simplifies the build configuration by: 1. AppKit uses vars.APPKIT_ENV_FILE (non-sensitive) 2. WalletKit uses secrets.WALLETKIT_ENV_FILE (contains API key) * chore: moved appkit env file to secrets * chore: minor updates * chore: consolidate CI/CD workflows (12 → 3 files) - Create unified release-appkit.yaml (replaces 4 dapp workflows) - Create unified release-walletkit.yaml (replaces 4 wallet workflows) - Create unified release-pos.yaml (replaces 4 POS workflows) - Remove unused env-file-path input from base workflows - Add e2e-build option for S3 uploads (AppKit SDK repo E2E tests) - Use workflow_dispatch inputs for platform/release-type selection Benefits: - 53% fewer workflow files (17 → 8) - Single source of truth per project - Better UX with dropdown menus in GitHub Actions * chore: added empty env check * chore: created new action to release PoC pos app
1 parent 130a541 commit bad3325

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+425
-673
lines changed

.github/workflows/release-android-base.yaml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ on:
2727
description: 'Path to get the APK file'
2828
required: true
2929
type: string
30-
env-file-path:
31-
description: "Path + name of the env file"
32-
required: false
33-
type: string
3430
upload-to-bucket:
3531
description: "Upload to S3"
3632
required: false
@@ -47,20 +43,10 @@ on:
4743
default: false
4844
type: boolean
4945
secrets:
50-
project-id:
51-
description: 'Reown Cloud ID'
52-
required: true
5346
firebase-app-id:
5447
required: true
5548
gsa-key:
5649
required: true
57-
relay-url:
58-
description: 'Relay URL'
59-
required: false
60-
pay-api-key:
61-
required: false
62-
sentry-dsn:
63-
required: false
6450
sentry-file:
6551
required: true
6652
secrets-file:
@@ -110,13 +96,18 @@ jobs:
11096
# Create env file
11197
- name: Create env file
11298
run: |
113-
ENV_FILE_CONTENT="${{ secrets.env-file }}"
114-
ENV_FILE_PATH="${{ inputs.env-file-path }}"
115-
if [ -n "$ENV_FILE_CONTENT" ] && [ -n "$ENV_FILE_PATH" ]; then
116-
echo "$ENV_FILE_CONTENT" > "$ENV_FILE_PATH"
117-
else
118-
touch ${{ inputs.root-path }}/.env.${{ inputs.release-type }}
119-
echo -e "ENV_PROJECT_ID=${{ secrets.project-id }}\nENV_RELAY_URL=${{ secrets.relay-url }}\nENV_SENTRY_DSN=${{ secrets.sentry-dsn }}\nENV_SENTRY_TAG=${{ inputs.release-type }}\nENV_PAY_API_KEY=${{ secrets.pay-api-key }}" >> ${{ inputs.root-path }}/.env.${{ inputs.release-type }}
99+
if [ -z "${{ secrets.env-file }}" ]; then
100+
echo "Error: env-file secret is empty or not set"
101+
exit 1
102+
fi
103+
echo "${{ secrets.env-file }}" > ${{ inputs.root-path }}/.env
104+
105+
- name: Copy variant files
106+
run: |
107+
cd ${{ inputs.root-path }}
108+
if [ -f "./scripts/copy-variant-files.sh" ]; then
109+
chmod +x ./scripts/copy-variant-files.sh
110+
./scripts/copy-variant-files.sh ${{ inputs.release-type }}
120111
fi
121112
122113
- name: Add Sentry file

.github/workflows/release-appkit.yaml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Stub workflow to enable dispatch from feature branches
2-
# Real implementation is on chore/ci-improvements branch
31
name: Release AppKit
42

3+
permissions:
4+
id-token: write
5+
contents: read
6+
57
on:
68
workflow_dispatch:
79
inputs:
@@ -26,7 +28,52 @@ on:
2628
default: false
2729

2830
jobs:
29-
stub:
30-
runs-on: ubuntu-latest
31-
steps:
32-
- run: echo "This is a stub. Run from feature branch with --ref"
31+
release-android:
32+
if: ${{ inputs.platform == 'android' }}
33+
uses: ./.github/workflows/release-android-base.yaml
34+
with:
35+
name: AppKit React Native
36+
root-path: 'dapps/W3MWagmi'
37+
release-type: ${{ inputs.release-type }}
38+
project-type: 'dapp'
39+
output-path: ${{ inputs.release-type == 'internal' && 'dapps/W3MWagmi/android/app/build/outputs/apk/internal/app-internal.apk' || 'dapps/W3MWagmi/android/app/build/outputs/apk/release/app-release.apk' }}
40+
upload-to-bucket: ${{ inputs.e2e-build }}
41+
secrets:
42+
env-file: ${{ secrets.APPKIT_ENV_FILE }}
43+
sentry-file: ${{ secrets.W3M_WAGMI_SENTRY_FILE }}
44+
secrets-file: ${{ secrets.ANDROID_SECRETS_FILE }}
45+
firebase-app-id: ${{ inputs.release-type == 'internal' && secrets.W3M_WAGMI_ANDROID_INTERNAL_FIREBASE_APP_ID || secrets.APPKIT_ANDROID_PROD_FIREBASE_APP_ID }}
46+
gsa-key: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
47+
keystore-name: ${{ inputs.release-type == 'internal' && secrets.WC_INTERNAL_KEYSTORE_NAME || vars.WC_PROD_KEYSTORE_NAME }}
48+
keystore: ${{ inputs.release-type == 'internal' && secrets.WC_INTERNAL_KEYSTORE || secrets.WC_PROD_KEYSTORE }}
49+
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
50+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
51+
firebase-url: ${{ inputs.release-type == 'internal' && vars.FIREBASE_APPKIT_INTERNAL_URL || vars.FIREBASE_APPKIT_PROD_URL }}
52+
53+
release-ios:
54+
if: ${{ inputs.platform == 'ios' }}
55+
uses: ./.github/workflows/release-ios-base.yaml
56+
with:
57+
name: AppKit React Native
58+
root-path: 'dapps/W3MWagmi'
59+
release-type: ${{ inputs.release-type }}
60+
scheme-name: ${{ inputs.release-type == 'internal' && 'W3MWagmi Internal' || 'W3MWagmi' }}
61+
bundle-id: ${{ inputs.release-type == 'internal' && 'com.walletconnect.web3modal.rnsample.internal' || 'com.walletconnect.web3modal.rnsample' }}
62+
apple-id: ${{ inputs.release-type == 'internal' && '6479817037' || '6446700301' }}
63+
project-type: 'dapp'
64+
build-for-simulator: ${{ inputs.e2e-build }}
65+
upload-to-bucket: ${{ inputs.e2e-build }}
66+
secrets:
67+
env-file: ${{ secrets.APPKIT_ENV_FILE }}
68+
sentry-file: ${{ secrets.W3M_WAGMI_SENTRY_FILE }}
69+
apple-username: ${{ secrets.APPLE_USERNAME }}
70+
apple-key-id: ${{ secrets.APPLE_KEY_ID }}
71+
apple-key-content: ${{ secrets.APPLE_KEY_CONTENT }}
72+
apple-issuer-id: ${{ secrets.APPLE_ISSUER_ID }}
73+
match-username: ${{ secrets.MATCH_USERNAME }}
74+
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
75+
match-git-url: ${{ secrets.MATCH_GIT_URL }}
76+
match-ssh-key: ${{ secrets.MATCH_SSH_KEY }}
77+
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
78+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
79+
testflight-url: ${{ inputs.release-type == 'internal' && vars.TESTFLIGHT_APPKIT_INTERNAL_URL || vars.TESTFLIGHT_APPKIT_PROD_URL }}

.github/workflows/release-dapp-android-internal.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/release-dapp-android-production.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/release-dapp-ios-internal.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/release-dapp-ios-production.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release-ios-base.yaml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ on:
3939
required: false
4040
default: false
4141
type: boolean
42-
env-file-path:
43-
description: "Path + name of the env file"
44-
required: false
45-
type: string
4642
upload-to-bucket:
4743
description: "Upload to S3"
4844
required: false
@@ -63,16 +59,6 @@ on:
6359
default: false
6460
type: boolean
6561
secrets:
66-
project-id:
67-
description: "WalletConnect Cloud ID"
68-
required: true
69-
relay-url:
70-
description: "WalletConnect Relay URL"
71-
required: false
72-
sentry-dsn:
73-
required: false
74-
pay-api-key:
75-
required: false
7662
sentry-file:
7763
required: true
7864
apple-username:
@@ -170,13 +156,18 @@ jobs:
170156
# Create env file
171157
- name: Create env file
172158
run: |
173-
ENV_FILE_CONTENT="${{ secrets.env-file }}"
174-
ENV_FILE_PATH="${{ inputs.env-file-path }}"
175-
if [ -n "$ENV_FILE_CONTENT" ] && [ -n "$ENV_FILE_PATH" ]; then
176-
echo "$ENV_FILE_CONTENT" > "$ENV_FILE_PATH"
177-
else
178-
touch ${{ inputs.root-path }}/.env.${{ inputs.release-type }}
179-
echo -e "ENV_PROJECT_ID=${{ secrets.project-id }}\nENV_RELAY_URL=${{ secrets.relay-url }}\nENV_SENTRY_DSN=${{ secrets.sentry-dsn }}\nENV_SENTRY_TAG=${{ inputs.release-type }}\nENV_PAY_API_KEY=${{ secrets.pay-api-key }}" >> ${{ inputs.root-path }}/.env.${{ inputs.release-type }}
159+
if [ -z "${{ secrets.env-file }}" ]; then
160+
echo "Error: env-file secret is empty or not set"
161+
exit 1
162+
fi
163+
echo "${{ secrets.env-file }}" > ${{ inputs.root-path }}/.env
164+
165+
- name: Copy variant files
166+
run: |
167+
cd ${{ inputs.root-path }}
168+
if [ -f "./scripts/copy-variant-files.sh" ]; then
169+
chmod +x ./scripts/copy-variant-files.sh
170+
./scripts/copy-variant-files.sh ${{ inputs.release-type }}
180171
fi
181172
182173
# Create sentry file

.github/workflows/release-pos-android.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)