-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (101 loc) · 4.23 KB
/
track-cli-releases.yml
File metadata and controls
125 lines (101 loc) · 4.23 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Track Docker CLI Releases
on:
schedule:
# Check for new releases daily at 07:00 UTC (1 hour after Moby tracking)
- cron: '0 7 * * *'
workflow_dispatch:
permissions:
contents: read
issues: write
actions: write
jobs:
check-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Check for new Docker CLI release
id: check
run: |
# Get latest stable tag from docker/cli repository
# Note: docker/cli uses tags but doesn't create GitHub Releases
LATEST=$(gh api repos/docker/cli/git/refs/tags \
--jq '.[] | select(.ref | test("refs/tags/v[0-9]+\\.[0-9]+\\.[0-9]+$")) | .ref' \
| sed 's|refs/tags/||' \
| sort -V \
| tail -n1)
if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then
echo "ERROR: Failed to fetch latest Docker CLI release"
exit 1
fi
echo "latest_release=$LATEST" >> $GITHUB_OUTPUT
# Check if we've already built this (using cli-v*-riscv64 format)
# Docker CLI tags are like v28.5.1, we create cli-v28.5.1-riscv64
CLEAN_VERSION="${LATEST#v}"
OUR_TAG="cli-v${CLEAN_VERSION}-riscv64"
if gh release view "${OUR_TAG}" >/dev/null 2>&1; then
echo "already_built=true" >> $GITHUB_OUTPUT
else
echo "already_built=false" >> $GITHUB_OUTPUT
fi
echo "Latest Docker CLI tag: $LATEST"
echo "Checking for: ${OUR_TAG}"
env:
GH_TOKEN: ${{ github.token }}
- name: Check for duplicate tracking issue
id: dedup
if: steps.check.outputs.already_built == 'false'
env:
GH_TOKEN: ${{ github.token }}
run: |
LATEST=${{ steps.check.outputs.latest_release }}
EXISTING=$(gh issue list \
--label cli-release \
--state all \
--search "in:title Building Docker CLI ${LATEST} for RISC-V64" \
--json number,title \
--jq 'map(select(.title == "Building Docker CLI '"${LATEST}"' for RISC-V64")) | .[0].number // empty') || {
echo "ERROR: gh issue list failed while checking duplicates for Docker CLI ${LATEST}"
exit 1
}
if [ -n "$EXISTING" ]; then
echo "ℹ️ Tracking issue #$EXISTING already exists for Docker CLI ${LATEST}, skipping build and issue"
echo "is_duplicate=true" >> $GITHUB_OUTPUT
else
echo "is_duplicate=false" >> $GITHUB_OUTPUT
fi
- name: Trigger automatic build for new release
if: steps.check.outputs.already_built == 'false' && steps.dedup.outputs.is_duplicate != 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
LATEST=${{ steps.check.outputs.latest_release }}
echo "New Docker CLI release detected: $LATEST"
echo "Triggering automatic build..."
gh workflow run cli-weekly-build.yml -f cli_ref=$LATEST
echo "Build triggered successfully!"
- name: Create tracking issue
if: steps.check.outputs.already_built == 'false' && steps.dedup.outputs.is_duplicate != 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
LATEST=${{ steps.check.outputs.latest_release }}
CLEAN_VERSION="${LATEST#v}"
cat > issue-body.md << EOF
New Docker CLI release detected: **$LATEST**
**Status:** Build automatically triggered
The cli-weekly-build workflow has been started automatically.
Expected completion time: ~5-10 minutes
**Monitor build progress:**
\`\`\`bash
gh run list --workflow=cli-weekly-build.yml --limit 1
gh run watch
\`\`\`
**Expected release:** cli-v${CLEAN_VERSION}-riscv64
**Upstream release notes:** https://github.com/docker/cli/releases/tag/$LATEST
This issue will track the build progress. Close it once the release is published.
EOF
gh issue create \
--title "Building Docker CLI ${LATEST} for RISC-V64" \
--body-file issue-body.md \
--label "build-in-progress,cli-release"