-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (77 loc) · 3.73 KB
/
Copy pathverify-published.yml
File metadata and controls
89 lines (77 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Verify Published Versions
# CI going green is not evidence that anything reached a user. The Chrome
# publish can be gated after a successful upload, AMO sits in a human review
# queue, and Edge has been failing auth silently. This job asks the stores what
# they actually serve and complains when that trails the newest tag.
on:
schedule:
- cron: "17 9 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
verify:
name: Compare stores against the newest tag
runs-on: ubuntu-latest
steps:
- name: Load environment variables
env:
ENV_CONTENT: ${{ secrets.ENV_FILE }}
run: |
while IFS='=' read -r key value; do
[[ -z "$key" || "$key" =~ ^# ]] && continue
[[ -n "$value" ]] && echo "::add-mask::$value"
echo "${key}=${value}" >> "$GITHUB_ENV"
done <<< "$ENV_CONTENT"
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Resolve the newest released version
id: tag
run: |
TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)
if [[ -z "$TAG" ]]; then
echo "::error::No release tag found"
exit 1
fi
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
echo "Newest tag: $TAG"
- name: Ask the stores what they serve
env:
RELEASED: ${{ steps.tag.outputs.version }}
run: |
behind=0
# Chrome: the update server is the only honest source — it returns the
# version real browsers will be handed, not the dashboard's draft.
CHROME_XML=$(curl -sS --max-time 30 \
"https://clients2.google.com/service/update2/crx?response=updatecheck&prodversion=140.0&acceptformat=crx2,crx3&x=id%3D${CHROME_EXTENSION_ID}%26uc" || true)
# Anchor to the <updatecheck> element: a bare ` version="` also matches
# the XML declaration's version="1.0" and silently reports that instead.
CHROME_VER=$(printf '%s' "$CHROME_XML" | grep -oP '<updatecheck[^>]*\sversion="\K[0-9][0-9.]*' | head -1)
if [[ -z "$CHROME_VER" ]]; then
echo "::warning::Could not read the Chrome update server response"
echo "- **Chrome**: :grey_question: could not be read" >> "$GITHUB_STEP_SUMMARY"
elif [[ "$CHROME_VER" == "$RELEASED" ]]; then
echo "- **Chrome**: :white_check_mark: serving $CHROME_VER" >> "$GITHUB_STEP_SUMMARY"
else
behind=1
{
echo "- **Chrome**: :x: serving **$CHROME_VER**, newest tag is **$RELEASED**"
echo " - A draft may be uploaded but unsubmitted. Check the **Privacy practices**"
echo " tab at <https://chrome.google.com/webstore/devconsole>."
} >> "$GITHUB_STEP_SUMMARY"
echo "::error title=Chrome is behind::Store serves $CHROME_VER but $RELEASED is tagged"
fi
# AMO review is a human queue, so lagging is normal and only worth a note.
AMO_VER=$(curl -sS --max-time 30 \
"https://addons.mozilla.org/api/v5/addons/addon/marksyncr/" \
| jq -r '.current_version.version // empty' || true)
if [[ -z "$AMO_VER" ]]; then
echo "- **Firefox**: :grey_question: could not be read" >> "$GITHUB_STEP_SUMMARY"
elif [[ "$AMO_VER" == "$RELEASED" ]]; then
echo "- **Firefox**: :white_check_mark: serving $AMO_VER" >> "$GITHUB_STEP_SUMMARY"
else
echo "- **Firefox**: :hourglass: serving $AMO_VER, newest tag is $RELEASED (review queue)" >> "$GITHUB_STEP_SUMMARY"
echo "::warning title=AMO is behind::AMO serves $AMO_VER but $RELEASED is tagged"
fi
exit $behind