Skip to content

Commit f82097a

Browse files
authored
Merge pull request #73 from JWCook/tag-based-releases
Automate releases based on git tags
2 parents 9b9f129 + 8819f45 commit f82097a

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# When a new git tag is pushed:
2+
# * Build and publish a new release to PyPI
3+
# * Create new GitHub release with placeholder text linking to changelog
4+
name: Release
5+
on:
6+
push:
7+
tags: ['*']
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: 3.11
19+
- name: Build package distributions
20+
run: |
21+
python -m pip install flit
22+
flit build
23+
- name: Publish package distributions to PyPI
24+
uses: pypa/gh-action-pypi-publish@release/v1
25+
- name: Create GitHub release
26+
uses: softprops/action-gh-release@v1
27+
body: "See [changelog](https://github.com/melissawm/sphinx-tags/blob/main/CHANGELOG.md) for release details."

docs/contribute/index.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ To cut a new release:
7474

7575
1. Make sure the version string in ``src/sphinx_tags/__init__.py`` is updated
7676
with the release number you want.
77-
2. Run ``flit publish`` to upload your new version to PyPI.
78-
3. Run ``git tag <version>``, and ``git push origin --tags`` to update the tags
77+
2. Run ``git tag <version>``, and ``git push origin --tags`` to update the tags
7978
on GitHub.
80-
4. Make a new release using the GitHub interface.
79+
3. This will trigger a `GitHub Action <https://github.com/melissawm/sphinx-tags/actions>`__
80+
that will build and publish the new release to PyPI. Verify that it completed
81+
successfully.
82+
4. A new `GitHub release <https://github.com/melissawm/sphinx-tags/releases>`__
83+
will be created automatically. Update the release description as needed.

0 commit comments

Comments
 (0)