chore(ci): inspect iOS signing certificates
This commit is contained in:
1 file changed
+49
-1
@@ -230,6 +230,55 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: List signing certificates
|
||||
shell: bash
|
||||
run: |
|
||||
node --input-type=module <<'NODE'
|
||||
import crypto from "node:crypto"
|
||||
|
||||
const base64url = (value) => Buffer.from(value).toString("base64url")
|
||||
const issuedAt = Math.floor(Date.now() / 1000)
|
||||
const header = base64url(JSON.stringify({
|
||||
alg: "ES256",
|
||||
kid: process.env.APPLE_API_KEY_ID,
|
||||
typ: "JWT",
|
||||
}))
|
||||
const payload = base64url(JSON.stringify({
|
||||
iss: process.env.APPLE_API_ISSUER,
|
||||
iat: issuedAt,
|
||||
exp: issuedAt + 1_200,
|
||||
aud: "appstoreconnect-v1",
|
||||
}))
|
||||
const unsigned = `${header}.${payload}`
|
||||
const signature = crypto.sign("sha256", Buffer.from(unsigned), {
|
||||
key: process.env.APPLE_API_KEY,
|
||||
dsaEncoding: "ieee-p1363",
|
||||
})
|
||||
const token = `${unsigned}.${signature.toString("base64url")}`
|
||||
const params = new URLSearchParams({
|
||||
"fields[certificates]": "name,displayName,certificateType,expirationDate,serialNumber,platform",
|
||||
limit: "200",
|
||||
})
|
||||
const response = await fetch(
|
||||
`https://api.appstoreconnect.apple.com/v1/certificates?${params}`,
|
||||
{ headers: { Authorization: `Bearer ${token}` } }
|
||||
)
|
||||
const body = await response.json()
|
||||
if (!response.ok) throw new Error(JSON.stringify(body.errors))
|
||||
for (const certificate of body.data) {
|
||||
const value = certificate.attributes
|
||||
console.log(JSON.stringify({
|
||||
id: certificate.id,
|
||||
name: value.name,
|
||||
displayName: value.displayName,
|
||||
type: value.certificateType,
|
||||
expires: value.expirationDate,
|
||||
serial: value.serialNumber,
|
||||
platform: value.platform,
|
||||
}))
|
||||
}
|
||||
NODE
|
||||
|
||||
- name: Archive and upload build 25
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -259,7 +308,6 @@ jobs:
|
||||
-authenticationKeyID "$APPLE_API_KEY_ID" \
|
||||
-authenticationKeyIssuerID "$APPLE_API_ISSUER" \
|
||||
DEVELOPMENT_TEAM=ARK85ZXQ4Z \
|
||||
CODE_SIGN_IDENTITY="Apple Distribution" \
|
||||
CURRENT_PROJECT_VERSION=25 \
|
||||
T3CODE_CLERK_PUBLISHABLE_KEY=pk_live_Y2xlcmsudDMuY29kZXMk \
|
||||
T3CODE_CLERK_JWT_TEMPLATE=t3-relay \
|
||||
|
||||
Reference in new issue
Block a user