arcade-mcp/.github/workflows/publish-toolkit.yml
Eric Gustin ab889f9f1d
Lint all toolkits (#183)
# PR Description
* Adds/updates the following files to all toolkits:
    - `.pre-commit-config.yaml`
    - `.ruff.toml`
    - `LICENSE`
    - `Makefile`
    - `pyproject.toml`
* Lint all toolkits such that they pass `make check` and `make test` (a
total doozy). This includes adding some unit tests and evals.
* Github workflow for testing toolkits before merge into main (courtesy
of @sdreyer)
* Added a QOL improvement for tool developers for when they need to get
the context's auth token.
* Minor updates to `arcade new` template.
2024-12-20 09:49:45 -08:00

71 lines
2 KiB
YAML

name: Publish Toolkit
on:
workflow_dispatch:
inputs:
toolkit:
description: 'The directory of the toolkit to publish'
required: true
jobs:
release-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Set toolkit input
id: set-toolkit
run: |
if [ "${{ github.event_name }}" = "push" ]; then
# Extract toolkit name from changed files
TOOLKIT=this_is_for_testing
echo "toolkit=$TOOLKIT" >> $GITHUB_OUTPUT
else
echo "toolkit=${{ inputs.toolkit }}" >> $GITHUB_OUTPUT
fi
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Poetry
uses: snok/install-poetry@v1
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Test Toolkit
id: Test_Toolkit
working-directory: toolkits/${{ steps.set-toolkit.outputs.toolkit }}
run: |
make install
make check
make test
- name: Publish Toolkit
id: Publish_Toolkit
working-directory: toolkits/${{ steps.set-toolkit.outputs.toolkit }}
run: |
poetry build
# Extract version from pyproject.toml using poetry and save it
VERSION=$(poetry version -s)
echo "version=$VERSION" >> $GITHUB_OUTPUT
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
- name: Send status to Slack
if: always()
uses: slackapi/slack-github-action@v2.0.0
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
status: "${{ (steps.Test_Toolkit.outcome == 'failure' || steps.Publish_Toolkit.outcome == 'failure') && 'Failed' || 'Success' }}"
toolkit: ${{ steps.set-toolkit.outputs.toolkit }}
version: ${{ steps.Publish_Toolkit.outputs.version }}
url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"