Repository navigation
98 lines (92 loc) · 3.58 KB
/
Copy pathupdate-skill.yml
File metadata and controls
98 lines (92 loc) · 3.58 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
name: Update Skill
on:
workflow_dispatch:
inputs:
version:
description: 'Plugin version for this release (e.g. 1.0.16625370)'
required: true
type: string
permissions:
contents: write
pull-requests: write
jobs:
update-skill:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: main
token: ${{ secrets.ADR_GITHUB_BOT_PAT }}
- name: Update android-cli skill from dac_skills.zip
run: |
SKILL_DSTS=(
plugins/android-cli-claude/skills/android-cli
plugins/android-cli-codex/skills/android-cli
plugins/android-cli-codex-public/skills/android-cli
)
curl -L -O https://dl.google.com/dac/dac_skills.zip
mkdir temp_extract
unzip -o dac_skills.zip -d temp_extract
# Fail loudly if the skill moves inside the zip
test -d temp_extract/devtools/android-cli
for SKILL_DST in "${SKILL_DSTS[@]}"; do
LICENSE_TMP=$(mktemp)
# LICENSE.txt is maintained in this repository, not in dac_skills.zip.
# Preserve an existing copy; seed a missing one from the repository license.
if [ -f "$SKILL_DST/LICENSE.txt" ]; then
cp "$SKILL_DST/LICENSE.txt" "$LICENSE_TMP"
else
cp LICENSE "$LICENSE_TMP"
fi
rm -rf "$SKILL_DST"
mkdir -p "$SKILL_DST"
cp -r temp_extract/devtools/android-cli/. "$SKILL_DST/"
cp "$LICENSE_TMP" "$SKILL_DST/LICENSE.txt"
rm -f "$LICENSE_TMP"
done
rm -rf temp_extract dac_skills.zip
- name: Set plugin version
env:
VERSION: ${{ inputs.version }}
run: |
# Claude Code only delivers an update when the version changes
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version must look like 1.0.16625370, got: $VERSION"
exit 1
fi
python3 - <<'PY'
import json, os, pathlib
version = os.environ['VERSION']
# Keep every packaged version in sync.
for path in (
'plugins/android-cli-claude/.claude-plugin/plugin.json',
'plugins/android-cli-codex/.codex-plugin/plugin.json',
'plugins/android-cli-codex-public/plugin.json',
):
p = pathlib.Path(path)
m = json.loads(p.read_text())
m['version'] = version
p.write_text(json.dumps(m, indent=2, ensure_ascii=False) + '\n')
print(f"Version set to {version}")
PY
- name: Commit and push to PR branch
env:
GH_TOKEN: ${{ secrets.ADR_GITHUB_BOT_PAT }}
run: |
BRANCH="update-skill/$(date +'%Y-%m-%d-%H%M')"
git config user.name "android-devrel-github-bot"
git config user.email "android-devrel-github-bot@users.noreply.github.com"
git checkout -b "$BRANCH"
git add -A
if git diff --cached --quiet; then
echo "No changes to commit — skipping PR creation."
exit 0
fi
git commit -m "Update android-cli skill ($(date +'%Y-%m-%d %H:%M'))"
git push origin "$BRANCH"
gh pr create \
--title "Update android-cli skill ($(date +'%Y-%m-%d %H:%M'))" \
--body "Automated update from the \`Update Skill\` workflow. Merging publishes a new plugin version." \
--base main \
--head "$BRANCH"