Skip to content

Commit

Permalink
Document release workflow (#50)
Browse files Browse the repository at this point in the history
* Remove automated release workflow

* Implement calver

* Update contributing guidelines

* Fix pipeline

* Add requirements step

* Remove zenodo bit

* Zero-pad month/day
  • Loading branch information
stefsmeets authored Aug 8, 2024
1 parent b6d725d commit cff6ddf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 46 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,7 @@ on:


jobs:
fix_release_deps:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip pip-tools setuptools
- name: Set configuration
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
- name: Create requirements files
run: |
python tools/generate_requirements_txt.py
pip-compile -o requirements_full.txt pyproject.toml
git add requirements_full.txt requirements.txt
git commit -m "Updated requirements.txt files" || true
- name: Bump version to new tag
run: |
python -m pip install bump-my-version
bump-my-version bump --new-version $GITHUB_REF_NAME patch
git commit -am "Bump version to: $GITHUB_REF_NAME"
- name: Push back changes to master and tag
run: |
git tag --force $GITHUB_REF_NAME HEAD
git push --force --tags
git switch -C master
git push --set-upstream -f origin master
deploy:
needs: fix_release_deps
runs-on: ubuntu-latest
environment: release
permissions:
Expand All @@ -55,9 +16,6 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- uses: actions/setup-python@v4
with:
python-version: '3.12'
Expand Down
27 changes: 26 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,29 @@ To check coverage:
coverage run -m pytest
coverage report # to output to terminal
coverage html # to generate html report
```
```


### Making a release

The versioning scheme we use is [CalVer](https://calver.org/).

0. Update requirements files:

```console
python tools/requirements_txt.py
pip-compile -o requirements_full.txt pyproject.toml
```

1. Bump the version (`release`/`patch`) as needed

```console
bump-my-version release
# 24.06.26
```

2. Commit and push your changes.

3. Make a new [release](https://github.com/FormingWorlds/JANUS/releases). Make sure to set the tag to the specified version, e.g. `24.06.26`.

4. The [upload to pypi](https://pypi.org/project/fwl-janus) is triggered when a release is published and handled by [this workflow](https://github.com/FormingWorlds/JANUS/actions/workflows/publish.yaml).
19 changes: 16 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "fwl-janus"
version = "24.6.26"
version = "24.06.26"
description = "Temperature structure generator for planetory atmospheres."
readme = "README.md"
authors = [
Expand Down Expand Up @@ -41,7 +41,7 @@ dependencies = [
'toml',
'tomlkit',
'f90nml',
'fwl-mors',
'fwl-mors',
'datetime'
]

Expand Down Expand Up @@ -81,7 +81,20 @@ source = ["janus"]
testpaths = ["tests"]

[tool.bumpversion]
current_version = "24.6.26"
# https://callowayproject.github.io/bump-my-version/howtos/calver/
current_version = "24.06.26"
parse = """(?x) # Verbose mode
(?P<release> # The release part
(?:[1-9][0-9])\\. # YY.
(?:[0-1][0-9])\\. # MM.
(?:[0-3][1-9]) # DD
)
(?:\\.(?P<patch>\\d+))? # .patch, optional
"""
serialize = ["{release}.{patch}", "{release}"]

[tool.bumpversion.parts.release]
calver_format = "{YY}.{0M}.{0D}"

[[tool.bumpversion.files]]
filename = "pyproject.toml"
Expand Down

0 comments on commit cff6ddf

Please sign in to comment.