Skip to content

Commit

Permalink
Merge pull request #296 from alan-turing-institute/community
Browse files Browse the repository at this point in the history
Community
  • Loading branch information
mastoffel authored Feb 7, 2025
2 parents 7a4dc72 + f821e6b commit 005b3c0
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install

- name: Build package
run: poetry build

- name: Publish package to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ If you'd like to find out more about AutoEmulate, make sure to check out:

This section provides a high-level guide to contributing to AutoEmulate, designed for those with little or no experience with open source projects. For more detailed information, please also refer to the docs for:

* [contributing emulators](contributing-emulators.md)
* [contributing to the docs](contributing-docs.md)
* [contributing emulators](https://alan-turing-institute.github.io/autoemulate/community/contributing-emulators.html)
* [contributing to the docs](https://alan-turing-institute.github.io/autoemulate/community/contributing-docs.html)

We welcome contributions of all kinds, be it code, documentation, or community engagement. We encourage you to read through the following sections to learn more about how you can contribute to the package.

Expand All @@ -45,7 +45,7 @@ After writing new code or modifying existing code, please make sure to:
* write tests in the `tests/` directory using [pytest](https://docs.pytest.org/en/7.4.x/).
* format the code using [black](https://github.com/psf/black)

It would be great if you could also [update the documentation](contributing-docs.md) to reflect the changes you've made. If you plan to add a new emulator have a look at the [contributing emulators docs](contributing-emulators.md).
It would be great if you could also [update the documentation](https://alan-turing-institute.github.io/autoemulate/community/contributing-docs.html) to reflect the changes you've made. If you plan to add a new emulator have a look at the [contributing emulators docs](https://alan-turing-institute.github.io/autoemulate/community/contributing-emulators.html).

### 3. Commit and Push

Expand Down Expand Up @@ -96,7 +96,7 @@ If you're stuck or need assistance:

## Inclusivity

We aim to make AutoEmulate a collaboratively developed project. We, therefore, require that all our members and their contributions **adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md)**. Please familiarise yourself with our Code of Conduct that lists the expected behaviours.
We aim to make AutoEmulate a collaboratively developed project. We, therefore, require that all our members and their contributions **adhere to our [Code of Conduct](https://github.com/alan-turing-institute/autoemulate/blob/main/CODE_OF_CONDUCT.md)**. Please familiarise yourself with our Code of Conduct that lists the expected behaviours.

Every contributor is expected to adhere to our Code of Conduct. It outlines our expectations and ensures a safe, respectful environment for everyone.

Expand Down
1 change: 1 addition & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ chapters:
- file: community/contributing
- file: community/contributing-emulators
- file: community/contributing-docs
- file: community/release
- file: community/code-of-conduct
- file: community/faq/index
sections:
Expand Down
2 changes: 1 addition & 1 deletion docs/community/contributing-docs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to the docs
# Contributing to the Docs

We welcome all documentation contributions, from fixing small typos to adding comprehensive tutorials. This guide will help you get started.

Expand Down
2 changes: 1 addition & 1 deletion docs/community/contributing-emulators.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing emulators
# Contributing Emulators

This guide explains how to contribute new emulator models to `AutoEmulate`.

Expand Down
84 changes: 84 additions & 0 deletions docs/community/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Releasing AutoEmulate

This guide explains how to create new releases of AutoEmulate for maintainers.

## Release Process

AutoEmulate uses GitHub Actions to automatically publish releases to PyPI when a new version tag is pushed. The process is as follows:

1. **Update Version Number**
First, give the package a new version. We recommend [this guide](https://py-pkgs.org/07-releasing-versioning.html) to decide on a version number.

Update the version in `pyproject.toml`:

```toml
[tool.poetry]
name = "autoemulate"
version = "X.Y.Z" # Update this line
```

2. **Update CHANGELOG.md**
Add a new section to `CHANGELOG.md` describing the changes in this release. Follow the existing format:

```markdown
## [X.Y.Z] - YYYY-MM-DD

- Added feature X
- Fixed bug Y
- Changed Z
```

3. **Create and Push Tag**
Create a new git tag following semantic versioning (vX.Y.Z):

```bash
git tag vX.Y.Z
git push origin vX.Y.Z
```

4. **Automated Release Process using GitHub Actions**

When you push a tag matching the pattern 'vX.Y.Z', the release workflow `release.yaml` will automatically:
- Check out the code
- Set up Python
- Install Poetry
- Install dependencies
- Build the package
- Publish to PyPI

The workflow requires a PyPI token stored in the repository secrets as `PYPI_TOKEN`.

## Prerequisites

Before creating a release, ensure:

1. All tests are passing on the main branch
2. Documentation is up to date
3. CHANGELOG.md is updated
4. You have appropriate permissions to push tags to the repository

## Troubleshooting

If the release fails:

1. Check the GitHub Actions logs for errors
2. Verify the PyPI token is correctly set in repository secrets
3. Ensure the version number in `pyproject.toml` matches the git tag
4. Make sure you haven't already published this version to PyPI

## Release Checklist

- [ ] Update version in `pyproject.toml`
- [ ] Update CHANGELOG.md
- [ ] Commit changes
- [ ] Create and push git tag
- [ ] Monitor GitHub Actions workflow
- [ ] Verify package is available on PyPI
- [ ] Test installation from PyPI

## Notes

- The release workflow only triggers on tags matching 'vX.Y.Z'
- Only maintainers with appropriate permissions can create releases
- Each version can only be published to PyPI once
- The workflow uses Python 3.10 for building and publishing
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "autoemulate"
version = "0.2.1"
version = "0.2.1dev1"
description = "A python package for semi-automated emulation"
license = "MIT"
authors = ["Martin Stoffel <mstoffel@turing.ac.uk>",
Expand Down

0 comments on commit 005b3c0

Please sign in to comment.