Skip to content

Commit 3c2e1fa

Browse files
committed
ADFA-1859: Switch Google Drive auth to Workload Identity Federation
1 parent 8b5d3e2 commit 3c2e1fa

1 file changed

Lines changed: 17 additions & 68 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 17 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -194,85 +194,34 @@ jobs:
194194

195195
- name: Download latest documentation.db from Google Drive
196196
run: |
197-
FOLDER_ID="${{ secrets.GOOGLE_DRIVE_FOLDER }}"
197+
FILE_ID="${{ secrets.DOCUMENTATION_DB_FILE_ID }}"
198198
ACCESS_TOKEN="${{ steps.auth_drive.outputs.access_token }}"
199199
200-
echo "Fetching files from Google Drive folder..."
201-
ALL_FILES=$(curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
202-
"https://www.googleapis.com/drive/v3/files?q=\"${FOLDER_ID}\"+in+parents&fields=files(id,name,mimeType,modifiedTime)&supportsAllDrives=true")
203-
204-
echo "Raw API Response:"
205-
echo "$ALL_FILES" | jq '.'
206-
207-
if echo "$ALL_FILES" | jq -e '.error' > /dev/null 2>&1; then
208-
echo "ERROR: Google Drive API returned an error"
209-
echo "$ALL_FILES" | jq '.error'
200+
if [ -z "$FILE_ID" ]; then
201+
echo "ERROR: DOCUMENTATION_DB_FILE_ID secret not set"
202+
echo "Please set the DOCUMENTATION_DB_FILE_ID secret in repository settings"
210203
exit 1
211204
fi
212205
213-
FILE_ID=$(echo "$ALL_FILES" | jq -r '.files[]? | select(.name=="documentation.db") | .id' | head -1)
206+
echo "Downloading documentation.db from Google Drive..."
207+
echo "File ID: $FILE_ID"
214208
215-
if [ -z "$FILE_ID" ]; then
216-
echo "ERROR: documentation.db not found in Google Drive folder"
217-
echo ""
218-
echo "Listing all files in the Google Drive folder:"
219-
echo "Parsed file list:"
220-
echo "$ALL_FILES" | jq -r '.files[]? | "- \(.name) (ID: \(.id), Type: \(.mimeType), Modified: \(.modifiedTime))"'
221-
echo "Total files found: $(echo "$ALL_FILES" | jq '.files | length // 0')"
222-
223-
jq -n '{
224-
blocks: [
225-
{
226-
type: "header",
227-
text: {
228-
type: "plain_text",
229-
text: ":x: Release Build Failed - documentation.db Not Found",
230-
emoji: true
231-
}
232-
},
233-
{
234-
type: "section",
235-
text: {
236-
type: "mrkdwn",
237-
text: "@here The daily release build failed because *documentation.db* could not be found in the Google Drive folder."
238-
}
239-
},
240-
{
241-
type: "section",
242-
text: {
243-
type: "mrkdwn",
244-
text: "*Action Required:*\n1. Verify documentation.db exists in the Google Drive folder\n2. Check the file name is exactly \"documentation.db\"\n3. Ensure the service account has access to the folder"
245-
}
246-
},
247-
{
248-
type: "actions",
249-
elements: [
250-
{
251-
type: "button",
252-
text: {
253-
type: "plain_text",
254-
text: "Open Google Drive Folder",
255-
emoji: true
256-
},
257-
url: "https://drive.google.com/drive/folders/${{ secrets.GOOGLE_DRIVE_FOLDER }}",
258-
action_id: "view-folder"
259-
}
260-
]
261-
}
262-
]
263-
}' > error_payload.json
209+
curl -L -H "Authorization: Bearer $ACCESS_TOKEN" \
210+
"https://www.googleapis.com/drive/v3/files/${FILE_ID}?alt=media&supportsAllDrives=true" \
211+
-o assets/documentation.db
264212
265-
# curl -X POST -H "Content-type: application/json" --data @error_payload.json "${{ secrets.SLACK_WEBHOOK_URL }}"
266-
# rm -f error_payload.json
213+
if [ ! -f assets/documentation.db ]; then
214+
echo "ERROR: Failed to download documentation.db"
267215
exit 1
268216
fi
269217
270-
echo "Downloading documentation.db (File ID: $FILE_ID)..."
271-
curl -L -H "Authorization: Bearer $ACCESS_TOKEN" \
272-
"https://www.googleapis.com/drive/v3/files/${FILE_ID}?alt=media&supportsAllDrives=true" \
273-
-o assets/documentation.db
218+
FILE_SIZE=$(du -h assets/documentation.db | cut -f1)
219+
echo "Downloaded documentation.db ($FILE_SIZE)"
274220
275-
echo "Downloaded documentation.db ($(du -h assets/documentation.db | cut -f1))"
221+
if [ "$FILE_SIZE" = "0B" ] || [ "$FILE_SIZE" = "0" ]; then
222+
echo "ERROR: Downloaded file is empty"
223+
exit 1
224+
fi
276225
277226
- name: Assemble Release APK
278227
run: |

0 commit comments

Comments
 (0)