-
Notifications
You must be signed in to change notification settings - Fork 11
65 lines (57 loc) · 1.92 KB
/
sync-versions-to-cdn.yml
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
name: Sync versions.json to CDN
on:
push:
branches:
- main
paths:
- configs/versions.json
workflow_dispatch:
# TODO(danielrozenberg): temporary, remove after testing is done
jobs:
sync:
if: github.repository == 'ampproject/cdn-configuration'
name: versions.json
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 1
- name: Install Dependencies
run: npm i -g @cloudflare/wrangler
- name: ⭐ Sync versions.json to the CDN ⭐
run: |
for CHANNEL in $(jq 'keys[]' configs/versions.json --raw-output)
do
RTV=$(jq ".[\"${CHANNEL}\"]" configs/versions.json --raw-output)
if [[ "${RTV}" != "null" ]]
then
echo "Setting ${CHANNEL} to ${RTV}"
wrangler kv:key put "${CHANNEL}" "${RTV}" --config .github/workflows/wrangler.toml --binding RTV
else
echo "Unsetting ${CHANNEL}"
wrangler kv:key delete "${CHANNEL}" --config .github/workflows/wrangler.toml --binding RTV --force
fi
done
env:
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
create-issue-on-error:
if: failure()
needs: sync
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Create issue on error
uses: JasonEtco/create-an-issue@v2
with:
filename: .github/create_issue_on_error.md
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
WORKFLOW_NAME: ${{ github.workflow }}
MENTION: '@ampproject/release-on-duty'
REPO_SLUG: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}