diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..422ca86 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,38 @@ +name: Release to PyPI +on: + release: + types: [published, edited] +jobs: + pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: extractions/setup-just@v1 + - name: Install poetry + run: pipx install poetry + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'poetry' + + - run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_KEY }}" + - name: install twine + run: | + pip install twine + + - name: download release + run: | + tag='${{ github.ref }}' + tag="${tag/refs\/tags\//}" + mkdir dist + cd dist + gh release download "$tag" -p 'extism-*' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: upload release + run: | + twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }} diff --git a/README.md b/README.md index cc99ca9..b137ad3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ # Extism Python Host SDK -See [https://extism.org/docs/integrate-into-your-codebase/python-host-sdk/](https://extism.org/docs/integrate-into-your-codebase/python-host-sdk/). \ No newline at end of file +See [https://extism.org/docs/integrate-into-your-codebase/python-host-sdk/](https://extism.org/docs/integrate-into-your-codebase/python-host-sdk/). + + +## Development + +### Release workflow + +1. Create a semver-formatted git tag (`git tag v1.0.0`). +2. Push that tag to the repository (`git push origin v1.0.0`.) +3. Wait for [the Build workflow to run](https://github.com/extism/python-sdk/actions/workflows/build.yaml). +4. Once the build workflow finishes, go to the [releases](https://github.com/extism/python-sdk/releases) page. You should + see a draft release. +5. Edit the draft release. Publish the release. +6. Wait for [the Release workflow to run](https://github.com/extism/python-sdk/actions/workflows/release.yaml). +7. Once the release workflow completes, you should be able to `pip install extism==${YOUR_TAG}` from PyPI. +