Repository navigation
Add CI and dist branch publishing #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7c08a7c
Add CI: build and test skills, publish dist branch
hackallcode 18542af
Harden CI: refuse publishing over master, Node 24 actions
hackallcode 45f01fa
Keep branch builds off the live dist, queue publishes
hackallcode 2ccff23
Trim dist publishing notes in CONTRIBUTING to instructions
hackallcode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # skills/** is built from modes/** and published to `dist`, the branch the plugin installs from (CONTRIBUTING.md, «Ветка `dist`»). | ||
|
|
||
| name: ci | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| workflow_dispatch: | ||
| inputs: | ||
| publish: | ||
| description: 'Publish the dist branch' | ||
| type: boolean | ||
| default: false | ||
| dist_branch: | ||
| description: 'Branch to publish to' | ||
| type: string | ||
| default: dist-test | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # A broken build fails silently as an empty plugin, so it is checked on every PR, not only before publishing. | ||
| check-skills: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.12' | ||
| - run: ./scripts/build-skills.py | ||
| - run: test -f skills/build/SKILL.md | ||
| - run: test -f skills/build/common.md | ||
| - run: python -m py_compile scripts/*.py scripts/mr_watch/*.py | ||
| - run: bash -n scripts/mr-reply.sh | ||
|
|
||
| # The tests fake `glab`; `jq` and `gawk` come with the runner image. | ||
| test-scripts: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.12' | ||
| - run: pip install --quiet pytest pyyaml | ||
| - run: python -m pytest tests -q | ||
|
|
||
| publish-skills: | ||
| needs: [check-skills, test-scripts] | ||
| # A manual run with `publish` checks publishing before merge; `dist_branch` keeps it off the live `dist`. | ||
| if: github.event_name == 'push' || inputs.publish | ||
| # Queued, not cancelled: the newest build lands last and its version is the highest. | ||
| concurrency: | ||
| group: publish-${{ inputs.dist_branch || 'dist' }} | ||
| cancel-in-progress: false | ||
| permissions: | ||
| contents: write | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| DIST_BRANCH: ${{ inputs.dist_branch || 'dist' }} | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| # The version patch is the commit count, which a shallow clone truncates. | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.12' | ||
| - run: ./scripts/build-skills.py --stamp-version | ||
| - run: | | ||
| git config user.name "${SKILLS_PUBLISH_NAME:-github-actions[bot]}" | ||
| git config user.email "${SKILLS_PUBLISH_EMAIL:-41898282+github-actions[bot]@users.noreply.github.com}" | ||
| # A force-push to the source branch would replace it with a build. | ||
| [ "$DIST_BRANCH" != "$DEFAULT_BRANCH" ] || { echo "::error::dist_branch must not be $DEFAULT_BRANCH"; exit 1; } | ||
| # A branch build would take the live version number from the next merge. | ||
| [ "$DIST_BRANCH" != dist ] || [ "$GITHUB_REF_NAME" = "$DEFAULT_BRANCH" ] || { echo "::error::dist is published only from $DEFAULT_BRANCH"; exit 1; } | ||
| git checkout -B "$DIST_BRANCH" | ||
| # skills/ is gitignored in the source branch. | ||
| git add -f skills .claude-plugin/plugin.json .codex-plugin/plugin.json | ||
| git commit --no-gpg-sign -m "Build skills from ${GITHUB_SHA::7}" | ||
| git push --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$DIST_BRANCH" | ||
| env: | ||
| SKILLS_PUBLISH_NAME: ${{ vars.SKILLS_PUBLISH_NAME }} | ||
| SKILLS_PUBLISH_EMAIL: ${{ vars.SKILLS_PUBLISH_EMAIL }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.