diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml new file mode 100644 index 0000000..f12c5a4 --- /dev/null +++ b/.github/workflows/pypi.yaml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: + - */v* + +jobs: + repo_name: + name: Get repo name + runs-on: ubuntu-latest + outputs: + repo_name: ${{ steps.split.outputs.repo_name }} + steps: + - name: Get repo name + # https://stackoverflow.com/questions/73402042/github-action-expressions-split-string + env: + TAG: ${{ github.ref_name }} + id: split + run: echo "repo_name=${TAG%%/*}" + release: + name: Release ${{ needs.repo_name.outputs.repo_name }} + runs-on: ubuntu-latest + needs: repo_name + environment: + name: pypi + url: https://pypi.org/p/${{ needs.repo_name.outputs.repo_name }} + permissions: + id-token: write + if: ${{ github.repository }} == 'stapi-spec/pystapi' + defaults: + run: + working-directory: ${{ needs.repo_name.outputs.repo_name }} + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Install build + run: uv pip install build + - name: Build + run: uv run python -m build + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..2e79ae0 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,16 @@ +# Releasing + +1. Determine which package you're releasing +2. Determine the next version, following [semantic versioning](https://semver.org/) +3. Create a release branch: `git checkout -b release/{package}-v{version}` +4. Update that package's CHANGELOG with: + - A new header with the new version + - A new link at the bottom of the CHANGELOG for that header +5. `git push -u origin` +6. Once approved, merge the PR +7. `git checkout main && git pull && git tag {package}/v{version} && git push {package}/v{version}` +8. Github actions will automatically publish the release on tag push +9. Create a new [release](https://github.com/stapi-spec/pystapi/releases) pointing to the new tag + +> [!NOTE] +> The tag format (`{package}/v{version}`) is very important, because that's how we discover which package to build and publish. diff --git a/stapi-pydantic/CHANGELOG.md b/stapi-pydantic/CHANGELOG.md index 2b0cd19..23c0f9b 100644 --- a/stapi-pydantic/CHANGELOG.md +++ b/stapi-pydantic/CHANGELOG.md @@ -5,3 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.0.1] - 2025-04-01 + +Initial release. + +[0.0.1]: https://github.com/stapi-spec/pystapi/releases/tag/v0.0.1