From cff6ddf3b7c35bd30117e5f1a0f2705c3534495e Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Thu, 8 Aug 2024 20:13:08 +0200 Subject: [PATCH] Document release workflow (#50) * Remove automated release workflow * Implement calver * Update contributing guidelines * Fix pipeline * Add requirements step * Remove zenodo bit * Zero-pad month/day --- .github/workflows/publish.yaml | 42 ---------------------------------- CONTRIBUTING.md | 27 +++++++++++++++++++++- pyproject.toml | 19 ++++++++++++--- 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 83156f3..9ab1d3c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -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: @@ -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' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8be4b5d..ac4206e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,4 +32,29 @@ To check coverage: coverage run -m pytest coverage report # to output to terminal coverage html # to generate html report -``` \ No newline at end of file +``` + + +### 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). diff --git a/pyproject.toml b/pyproject.toml index 17cf7e7..0e5432d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ @@ -41,7 +41,7 @@ dependencies = [ 'toml', 'tomlkit', 'f90nml', - 'fwl-mors', + 'fwl-mors', 'datetime' ] @@ -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 # The release part + (?:[1-9][0-9])\\. # YY. + (?:[0-1][0-9])\\. # MM. + (?:[0-3][1-9]) # DD + ) + (?:\\.(?P\\d+))? # .patch, optional +""" +serialize = ["{release}.{patch}", "{release}"] + +[tool.bumpversion.parts.release] +calver_format = "{YY}.{0M}.{0D}" [[tool.bumpversion.files]] filename = "pyproject.toml"