-
-
Notifications
You must be signed in to change notification settings - Fork 4
E2e env actions #85
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
base: main
Are you sure you want to change the base?
E2e env actions #85
Changes from all commits
a75fa8b
ab67bec
22a7b88
610d928
6ebb0f3
f6e583d
e4322a4
4a81330
bc2f52f
27eed96
c9e4d1e
f5c4f53
860c7d4
4898cab
8b76ea8
f1008f7
9884d8a
682cafb
6a1ff90
38bd065
2f5e2a6
a3ea5d4
8f3fdcb
c7d9987
90d1bd2
bfd20d8
6d49bac
b2e0ef3
c35dbc6
9e75e06
dda3178
03cd24b
4b4e46f
02ff9a9
5695370
f399c35
4d87552
929ddaa
d9de05d
18421e8
93cf96a
db78229
37051d0
dade476
8529256
3b49d84
a4ca242
b1867a9
860e85f
032380e
eea10a6
1366275
1a08796
367c013
d7a349b
4459e30
4ee8ff1
9e04cea
aa884d6
a4d8ac3
a3cd1cb
b748908
8553525
cf5b15f
5827d99
ac3212f
f850b3e
a3886bc
af1ea7a
9c67713
87877ab
48f952e
7228375
d942920
c9620dc
6fe7aea
f8b417a
11952a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: 'Configure Keystore' | ||
description: 'Assume an AWS role and fetch a secret into environment variables' | ||
|
||
inputs: | ||
aws-role-to-assume: | ||
description: 'The AWS IAM role to assume' | ||
required: true | ||
aws-region: | ||
description: 'The AWS region where the secret is stored' | ||
required: true | ||
secret-name: | ||
description: 'The name of the secret in AWS Secrets Manager' | ||
required: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Unused Required Input Causes Workflow FailuresThe Locations (1)There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Unused Required Input Causes Misleading ConfigurationThe |
||
platform: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Redundant Secret Name InputThe Locations (1) |
||
description: 'The platform for which the keystore is being configured (e.g., ios, android)' | ||
required: true | ||
target: | ||
description: 'The target for which the keystore is being configured (e.g., qa, flask, main)' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Determine signing secret name | ||
shell: bash | ||
run: | | ||
case "${{ inputs.target }}" in | ||
qa) | ||
SECRET_NAME="metamask-mobile-qa-signing-certificates" | ||
;; | ||
flask) | ||
SECRET_NAME="metamask-mobile-flask-signing-certificates" | ||
;; | ||
main) | ||
SECRET_NAME="metamask-mobile-main-signing-certificates" | ||
;; | ||
*) | ||
echo "β Unknown environment: ${{ inputs.environment }}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Incorrect Error Message Variable ReferenceThe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
exit 1 | ||
;; | ||
esac | ||
echo "AWS_SIGNING_CERT_SECRET_NAME=$SECRET_NAME" >> "$GITHUB_ENV" | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ inputs.aws-role-to-assume }} | ||
aws-region: ${{ inputs.aws-region }} | ||
|
||
- name: Fetch secret and export as environment variables | ||
shell: bash | ||
run: | | ||
echo "π Fetching secret from Secrets Manager..." | ||
secret_json=$(aws secretsmanager get-secret-value \ | ||
--region "${{ inputs.aws-region }}" \ | ||
--secret-id "${AWS_SIGNING_CERT_SECRET_NAME}" \ | ||
--query SecretString \ | ||
--output text) | ||
|
||
keys=$(echo "$secret_json" | jq -r 'keys[]') | ||
for key in $keys; do | ||
value=$(echo "$secret_json" | jq -r --arg k "$key" '.[$k]') | ||
echo "::add-mask::$value" | ||
echo "$key=$(printf '%s' "$value")" >> "$GITHUB_ENV" | ||
echo "β Set secret for key: $key" | ||
done | ||
|
||
- name: Configure Android Signing Certificates | ||
if: inputs.platform == 'android' | ||
shell: bash | ||
run: | | ||
echo "π¦ Configuring Android keystore..." | ||
if [[ -z "$ANDROID_KEYSTORE" ]]; then | ||
echo "β οΈ ANDROID_KEYSTORE is not set. Skipping keystore decoding." | ||
exit 1 | ||
fi | ||
|
||
# Use provided path if set, fallback to default | ||
KEYSTORE_PATH="${ANDROID_KEYSTORE_PATH:-/tmp/android.keystore}" | ||
echo "$ANDROID_KEYSTORE" | base64 --decode > "$KEYSTORE_PATH" | ||
echo "β Android keystore written to $KEYSTORE_PATH" | ||
|
||
- name: Configure iOS Signing Certificates | ||
if: inputs.platform == 'ios' | ||
shell: bash | ||
run: | | ||
echo "π¦ Configuring iOS code signing..." | ||
|
||
# Create paths | ||
CERT_PATH="$RUNNER_TEMP/build_certificate.p12" | ||
PROFILE_PATH="$RUNNER_TEMP/build_pp.mobileprovision" | ||
KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db" | ||
CERT_PW="${IOS_SIGNING_KEYSTORE_PASSWORD}" | ||
|
||
# Decode base64 files | ||
echo "$IOS_SIGNING_KEYSTORE" | base64 --decode > "$CERT_PATH" | ||
echo "$IOS_SIGNING_PROFILE" | base64 --decode > "$PROFILE_PATH" | ||
echo "β Decoded .p12 and provisioning profile" | ||
|
||
# Create and unlock keychain | ||
security create-keychain -p "$CERT_PW" "$KEYCHAIN_PATH" | ||
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" | ||
security unlock-keychain -p "$CERT_PW" "$KEYCHAIN_PATH" | ||
|
||
# Import cert | ||
security import "$CERT_PATH" -P "$CERT_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" > /dev/null | ||
security set-key-partition-list -S apple-tool:,apple: -k "$CERT_PW" "$KEYCHAIN_PATH" > /dev/null | ||
security find-identity -p codesigning "$KEYCHAIN_PATH" | ||
|
||
|
||
# Install provisioning profile | ||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp "$PROFILE_PATH" ~/Library/MobileDevice/Provisioning\ Profiles/ | ||
echo "β Installed provisioning profile" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Redundant Secret Input Causes Confusion
The
secret-name
input is defined as required but is never used by the action. Instead, the secret name is dynamically determined from theenvironment
input, renderingsecret-name
redundant and confusing.Locations (1)
.github/actions/configure-keystore/action.yml#L10-L13