6310b56f26
Add a reproducible way to build the Claude-skill package and publish it: - scripts/build-skill-zip.sh: stages SKILL.md + README + references/ + assets/ into a zip whose single top-level cycling-training/ folder is the layout Claude Desktop / claude.ai import expects. Validates SKILL.md frontmatter. - .gitea/workflows/release-skill.yml: on tag v* builds the zip and attaches it to a Gitea release (via the API using the automatic token); on manual dispatch uploads it as a run artifact. - README: document the packaging/release flow and Claude Desktop zip-import. - .gitignore: ignore dist/ build output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TqrhBhC3GEcKyaw8RTk8G6
91 lines
3.3 KiB
YAML
91 lines
3.3 KiB
YAML
name: Package skill
|
|
|
|
# Builds the installable Claude-skill zip (dist/cycling-training-<version>.zip).
|
|
#
|
|
# - Push a tag v* -> builds the zip AND attaches it to a Gitea release.
|
|
# - Run manually -> builds the zip and uploads it as a run artifact.
|
|
#
|
|
# Requirements on the Gitea side:
|
|
# * A registered Actions runner (image with bash/zip/curl, e.g. catthehacker/ubuntu).
|
|
# * Actions enabled for this repo (Settings > Actions).
|
|
# * The automatic ${{ secrets.GITHUB_TOKEN }} must have contents:write so the
|
|
# release step can create the release / upload the asset (granted via the
|
|
# `permissions` block below on Gitea >= 1.20).
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version label for the zip (e.g. v1.0.0)'
|
|
required: false
|
|
default: 'manual'
|
|
|
|
jobs:
|
|
package:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Determine version
|
|
id: ver
|
|
run: |
|
|
if [ "${{ github.ref_type }}" = "tag" ]; then
|
|
echo "version=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Build skill zip
|
|
run: bash scripts/build-skill-zip.sh "${{ steps.ver.outputs.version }}"
|
|
|
|
- name: Upload run artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: cycling-training-skill-${{ steps.ver.outputs.version }}
|
|
path: dist/*.zip
|
|
if-no-files-found: error
|
|
|
|
- name: Attach zip to release
|
|
if: github.ref_type == 'tag'
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SERVER: ${{ github.server_url }}
|
|
REPO: ${{ github.repository }}
|
|
VERSION: ${{ steps.ver.outputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
ZIP="$(ls dist/*.zip | head -1)"
|
|
echo "Publishing ${ZIP} to ${SERVER}/${REPO} release ${VERSION}"
|
|
|
|
# Create the release for this tag; if it already exists, look up its id.
|
|
REL_ID="$(curl -sS -X POST \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
"${SERVER}/api/v1/repos/${REPO}/releases" \
|
|
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"body\":\"Installable Claude-skill package for cycling-training. Download the .zip below and import it in Claude Desktop / claude.ai (Settings > Skills) or unzip into your Claude Code skills directory.\"}" \
|
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2 || true)"
|
|
|
|
if [ -z "${REL_ID}" ]; then
|
|
REL_ID="$(curl -sS \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
"${SERVER}/api/v1/repos/${REPO}/releases/tags/${VERSION}" \
|
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)"
|
|
fi
|
|
|
|
if [ -z "${REL_ID}" ]; then
|
|
echo "ERROR: could not create or find a release for tag ${VERSION}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
curl -sS -X POST \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
-F "attachment=@${ZIP}" \
|
|
"${SERVER}/api/v1/repos/${REPO}/releases/${REL_ID}/assets?name=$(basename "${ZIP}")"
|
|
echo "Attached $(basename "${ZIP}") to release ${VERSION} (id ${REL_ID})."
|