|
| 1 | +name: Build .skill archive |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [trunk] |
| 6 | + paths-ignore: |
| 7 | + - '*.skill' |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +env: |
| 13 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Delay |
| 21 | + run: sleep 30 |
| 22 | + |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Build .skill |
| 27 | + run: | |
| 28 | + SKILL_NAME=$(basename "$GITHUB_WORKSPACE") |
| 29 | + cp -r "$GITHUB_WORKSPACE" "/tmp/${SKILL_NAME}" |
| 30 | + rm -rf "/tmp/${SKILL_NAME}/.github" |
| 31 | + rm -f "$GITHUB_WORKSPACE/${SKILL_NAME}.skill" |
| 32 | + cd /tmp |
| 33 | + zip -r "$GITHUB_WORKSPACE/${SKILL_NAME}.skill" "${SKILL_NAME}/" \ |
| 34 | + -x "${SKILL_NAME}/.git/*" \ |
| 35 | + -x "${SKILL_NAME}/*.skill" \ |
| 36 | + -x "${SKILL_NAME}/evals/*" \ |
| 37 | + -x "${SKILL_NAME}/__pycache__/*" \ |
| 38 | + -x "${SKILL_NAME}/node_modules/*" \ |
| 39 | + -x "${SKILL_NAME}/.DS_Store" \ |
| 40 | + -x "*.pyc" |
| 41 | +
|
| 42 | + - name: Verify archive |
| 43 | + run: | |
| 44 | + SKILL_NAME=$(basename "$GITHUB_WORKSPACE") |
| 45 | + echo "=== contents ===" |
| 46 | + unzip -l "${SKILL_NAME}.skill" |
| 47 | + echo "=== excluded check ===" |
| 48 | + unzip -l "${SKILL_NAME}.skill" \ |
| 49 | + | grep -E '__pycache__|node_modules|\.pyc$|\.DS_Store|\.git/|\.github/|/evals/' \ |
| 50 | + && { echo "FAIL — excluded files in archive"; exit 1; } \ |
| 51 | + || echo "clean" |
| 52 | +
|
| 53 | + - name: Commit and push |
| 54 | + run: | |
| 55 | + SKILL_NAME=$(basename "$GITHUB_WORKSPACE") |
| 56 | + VERSION=$(grep -m1 'version:' SKILL.md | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') |
| 57 | + DATETIME=$(date -u '+%Y-%m-%dT%H%M%SZ') |
| 58 | + git config user.name "github-actions[bot]" |
| 59 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 60 | + git add "${SKILL_NAME}.skill" |
| 61 | + git diff --cached --quiet \ |
| 62 | + && echo "no change — skip commit" \ |
| 63 | + || git commit \ |
| 64 | + --message "build: ${SKILL_NAME} v${VERSION} ${DATETIME} [skip ci]" \ |
| 65 | + --trailer "Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" |
| 66 | + git push |
0 commit comments