Skip to content

Commit

Permalink
Add new publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Jan 22, 2024
1 parent e78b864 commit 59fc4a6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 22 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: "Check out source code"
uses: "actions/checkout@v4"
- name: "Install Python"
uses: "actions/setup-python@v5"
- name: "Install dependencies"
run: pip install setuptools wheel build
- name: "Build"
run: python -m build
- name: "Publish"
uses: pypa/gh-action-pypi-publish@release/v1

6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
ci:
autofix_prs: false
skip:
- pip-compile # network access is unavailable in pre-commit.ci runners
- mypy # executable not found?

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ See the fragment files in the `changelog.d directory`_.

.. scriv-insert-here
.. _changelog-0.7.6:

0.7.6 — 2024-01-22
==================

Added
-----

- Publish to PyPI with Trusted Publishing.

Changed
-------

- Update dependencies.

.. _changelog-0.7.5:

0.7.5 — 2023-12-13
Expand Down
2 changes: 1 addition & 1 deletion a3m/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "0.7.5"
__version__ = "0.7.6"

__all__ = ["__version__"]
10 changes: 6 additions & 4 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,21 @@ Releases
1. Make sure that ``a3m.__version__`` reflects the new version.
2. Make sure that the changelog has been updated.
Use ``scriv collect`` to populate ``CHANGELOG.rst``, submit the changes.
3. Run ``tox -e publish`` to publish the package to PyPI.
4. Create and push git tag, e.g.::
3. Create and push git tag, e.g.::

$ git tag v0.7.1
$ git push origin refs/tags/v0.7.1

5. Build Docker image::
This should have triggered the publishing workflow. Confirm that the new
version of the package is in `PyPI <https://pypi.org/project/a3m/>`_.

4. Build Docker image::

$ docker build \
-t ghcr.io/artefactual-labs/a3m:latest \
-t ghcr.io/artefactual-labs/a3m:v0.7.1 \
.
6. Push Docker image to the registry::
5. Push Docker image to the registry::

$ docker push ghcr.io/artefactual-labs/a3m:latest
$ docker push ghcr.io/artefactual-labs/a3m:v0.7.2
11 changes: 0 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,6 @@ legacy_tox_ini = """
[testenv:pre-commit]
skip_install = true
commands = pre-commit run --all-files --show-diff-on-failure
[testenv:publish]
skip_install = true
allowlist_externals =
twine
rm
commands =
rm -rf {toxinidir}/build {toxinidir}/dist
python -m build
twine check --strict {toxinidir}/dist/*
twine upload dist/* -r a3m
"""

[tool.doc8]
Expand Down

0 comments on commit 59fc4a6

Please sign in to comment.