mirror of
https://github.com/android/skills.git
synced 2026-09-14 20:07:09 +08:00
Update workflows with agent marketplace generation files (#124)
* Update workflows with agent marketplace generation files * Fix failing zizmor errors * Modify update-skills steps to update agent marketplace files and skill lists with every new update * Modify update-skills steps to update agent marketplace files and skill lists with every new update * Resolve comments
This commit is contained in:
@@ -16,9 +16,41 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout main
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: main
|
||||
token: ${{ secrets.ADR_GITHUB_BOT_PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Update Codex Plugin Version
|
||||
env:
|
||||
TAG_NAME: ${{ inputs.tag_name }}
|
||||
run: |
|
||||
VERSION="${TAG_NAME#v}"
|
||||
echo "Updating .codex-plugin/plugin.json version to $VERSION"
|
||||
|
||||
VERSION="$VERSION" python3 -c "
|
||||
import json
|
||||
import os
|
||||
|
||||
version = os.environ['VERSION']
|
||||
path = '.codex-plugin/plugin.json'
|
||||
with open(path, 'r') as f:
|
||||
data = json.load(f)
|
||||
data['version'] = version
|
||||
with open(path, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
f.write('\n')
|
||||
"
|
||||
|
||||
- name: Commit and push updated version
|
||||
env:
|
||||
TAG_NAME: ${{ inputs.tag_name }}
|
||||
run: |
|
||||
git config user.name "android-devrel-github-bot"
|
||||
git config user.email "android-devrel-github-bot@users.noreply.github.com"
|
||||
git add .codex-plugin/plugin.json
|
||||
git commit -m "Bump plugin version to $TAG_NAME" || echo "No version change to commit"
|
||||
git push origin main
|
||||
|
||||
- name: Create Zip Archive
|
||||
run: |
|
||||
@@ -26,6 +58,10 @@ jobs:
|
||||
|
||||
- name: Create Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.ADR_GITHUB_BOT_PAT || secrets.GITHUB_TOKEN }}
|
||||
TAG_NAME: ${{ inputs.tag_name }}
|
||||
run: |
|
||||
gh release create ${{ inputs.tag_name }} android-skills.zip --title "Release ${{ inputs.tag_name }}" --notes "Manual release of main branch contents."
|
||||
gh release create "$TAG_NAME" android-skills.zip \
|
||||
--target main \
|
||||
--title "Release $TAG_NAME" \
|
||||
--notes "Release $TAG_NAME of Android Skills."
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout main
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: main
|
||||
token: ${{ secrets.ADR_GITHUB_BOT_PAT }}
|
||||
@@ -59,6 +59,47 @@ jobs:
|
||||
rm -rf temp_skills
|
||||
echo "Successfully copied directories from github-skills branch."
|
||||
|
||||
- name: Update Skill Lists in Plugin Files
|
||||
run: |
|
||||
python3 -c "
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
# Discover all skills with SKILL.md
|
||||
skill_paths = []
|
||||
for path in pathlib.Path('.').glob('**/SKILL.md'):
|
||||
if any(p.startswith('.') for p in path.parts[:-1]):
|
||||
continue
|
||||
skill_paths.append(f'./{path.parent.as_posix()}')
|
||||
|
||||
skill_paths = sorted(list(set(skill_paths)))
|
||||
|
||||
# 1. Update .claude-plugin/marketplace.json in-place
|
||||
claude_file = pathlib.Path('.claude-plugin/marketplace.json')
|
||||
if not claude_file.exists():
|
||||
raise FileNotFoundError(f'Required file {claude_file} does not exist. Ensure you are running on the correct branch.')
|
||||
|
||||
with open(claude_file, 'r') as f:
|
||||
data = json.load(f)
|
||||
if 'plugins' in data and len(data['plugins']) > 0:
|
||||
data['plugins'][0]['skills'] = skill_paths
|
||||
with open(claude_file, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
f.write('\n')
|
||||
|
||||
# 2. Update .codex-plugin/plugin.json in-place
|
||||
codex_file = pathlib.Path('.codex-plugin/plugin.json')
|
||||
if not codex_file.exists():
|
||||
raise FileNotFoundError(f'Required file {codex_file} does not exist. Ensure you are running on the correct branch.')
|
||||
|
||||
with open(codex_file, 'r') as f:
|
||||
data = json.load(f)
|
||||
data['skills'] = [{'source': {'path': p}} for p in skill_paths]
|
||||
with open(codex_file, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
f.write('\n')
|
||||
"
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config user.name "android-devrel-github-bot"
|
||||
|
||||
Reference in New Issue
Block a user