Skip to content

Commit

Permalink
Fixing and simplifying CI/CD release process. (#418)
Browse files Browse the repository at this point in the history
* Removed github-tag-action

* Updated guide on versioning.

* Added CI fixes to changelog.

* Wrote a deploy script.

* Excluded extra files from distribution.

* Excluded extra files being added by scm to dists.

* Removed (hopefully) unneeded step to deploy.

* Removed github tag action as dependency all together for the release.

* Added Brenna's email to make core metadata clearer to help pypi.

* Updated changelog.

* Added link to PyPI project.

* Add sphinx.ext.extlinks to Sphinx configuration

* Add MCNP6.3 user's manual extlink markup

* Use extlink for the first time.

* Removed github-tag-action

* Updated guide on versioning.

* Added CI fixes to changelog.

* Wrote a deploy script.

* Excluded extra files from distribution.

* Excluded extra files being added by scm to dists.

* Removed (hopefully) unneeded step to deploy.

* Removed github tag action as dependency all together for the release.

* Prototyped how to link to manual.

* Made block more to the point.

* Made very compact additional info section.

* Made pull request and issue links.

* Added linkcheck test.

* Disabled failure from linkcheck due to bugs with #414.

* Fixed typo in numbered list.

* Added all hierarchy to MCNP manual links.

* Updated manual link.

* Updated dev guide to be pyproject based.

* Updated pytest migration.

* Started deploy checklist.

* Removed version numbering because it's clear.

* Ignore a build symlink I made.

* Added new doc features to changelog.

* Updating changelog to next version: 0.2.8

* Got changelog up to date and working.

* Added Brenna's email to make core metadata clearer to help pypi.

* Updated changelog.

* Added link to PyPI project.

* Add sphinx.ext.extlinks to Sphinx configuration

* Add MCNP6.3 user's manual extlink markup

* Use extlink for the first time.

* Removed github-tag-action

* Updated guide on versioning.

* Added CI fixes to changelog.

* Wrote a deploy script.

* Excluded extra files from distribution.

* Excluded extra files being added by scm to dists.

* Removed (hopefully) unneeded step to deploy.

* Removed github tag action as dependency all together for the release.

* Prototyped how to link to manual.

* Made block more to the point.

* Made very compact additional info section.

* Made pull request and issue links.

* Added linkcheck test.

* Disabled failure from linkcheck due to bugs with #414.

* Fixed typo in numbered list.

* Added all hierarchy to MCNP manual links.

* Updated manual link.

* Updated dev guide to be pyproject based.

* Updated pytest migration.

* Started deploy checklist.

* Removed version numbering because it's clear.

* Ignore a build symlink I made.

* Added new doc features to changelog.

* Updating changelog to next version: 0.2.8

* Revert "Updating changelog to next version: 0.2.8"

This reverts commit bbdcf70.

* Made deploy script less risky.

* Removed changelog test that always fails on deploy.

* Added more guardrails.

* Added check that the tag release is ready.

* Moved complex bash out of yaml.

* Fixed repeated steps.

* actually pass the needed arguments.

* Ensured checking script returns non-0.

* Ensured that actions are properly ordered.

* Updating changelog to next version: 0.2.8

* Made it push all commits

* Updated deploy checklist.

* DRY -_-

* Revert "Updating changelog to next version: 0.2.8"

This reverts commit a15f1d6.

* Updating changelog to next version: 0.2.9

* Fixed issue with out how releases are identified.

* Made pull request and issue links.

* Removed broken link to angular commit messages.

* Made changelog test not run on main.

* Removed redundant get version.

* Changed master to main.

* Configured montepy.org custom domain.

---------

Co-authored-by: Travis J. Labossiere-Hickman <[email protected]>
  • Loading branch information
MicahGale and tjlaboss authored Jun 26, 2024
1 parent f2efd34 commit 1df0cf5
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 52 deletions.
6 changes: 6 additions & 0 deletions .github/scripts/check_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

if [[ "$1" == *"dev"* ]];
then
exit 1
fi
28 changes: 28 additions & 0 deletions .github/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

new_ver=$1

echo "next version: $new_ver"

read -p "Are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# do dangerous stuff

echo "Updating Changelog"

sed -i "s/#Next Version#/$new_ver/w changes" doc/source/changelog.rst
git diff
read -p "Are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
git add doc/source/changelog.rst

echo "Updating changelog to next version: " > commit_template

git commit -t commit_template && rm commit_template && echo "Tagging next release" && git tag "v$new_ver" && git push --tags && git push
fi
fi

43 changes: 9 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:
name: github-pages
runs-on: ubuntu-latest
steps:
- name: Configure git
env:
TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: git config --global url."https://${TOKEN}:[email protected]/".insteadOf "https://github.com/"
- uses: actions/checkout@v4
with:
ref: main
Expand Down Expand Up @@ -60,31 +56,11 @@ jobs:
with:
python-version: 3.8
- run: pip install . montepy[build]
- uses: mathieudutour/[email protected]
name: Get next version number (dry)
id: version_num
with:
dry_run: True
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Update changelog version
run: |
sed -i "s/#Next Version#/${{steps.version_num.outputs.new_version}}/w changes" doc/source/changelog.rst
[[ -s changes ]] || exit 1
- name: Commit new changelog
uses: actions4git/[email protected]
with:
add-pathspec: doc/source
commit-message: Update Changelog version to ${{steps.version_num.outputs.new_version}}
- name: GitHub Actions Create Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# ensure tags are up to date
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Get Version
id: get_version
run: echo "version=`python -m setuptools_scm`" >> $GITHUB_OUTPUT
- name: Verify that this is a non-dev release
run: .github/scripts/check_version.sh ${{ steps.get_version.outputs.version }}
- run: python -m build .
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
Expand All @@ -95,15 +71,14 @@ jobs:
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
tag: v${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
draft: true
- run: >-
gh release upload
'${{ steps.tag_version.outputs.new_tag }}' dist/**
'v${{ steps.get_version.outputs.version }}' dist/**
--repo '${{ github.repository }}'
- uses: actions/upload-artifact@v4.3.1
- uses: actions/upload-artifact@v4
with:
name: build
path: |
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ jobs:
with:
dry_run: True
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Update changelog version
run: |
sed -i "s/#Next Version#/${{steps.version_num.outputs.new_version}}/w changes" doc/source/changelog.rst
[[ -s changes ]] || exit 1
- run: sphinx-build doc/source/ doc/build/ -W --keep-going -E
name: Build site strictly
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -140,6 +136,7 @@ jobs:

changelog-test:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
montepy.org
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
exclude tests/test_version.py
recursive-exclude doc *
recursive-exclude demo *
recursive-exclude graphics *
recursive-exclude .github *
3 changes: 2 additions & 1 deletion doc/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MontePy Changelog
=================

#Next Version#
*Next Version*
----------------------

**Bug fixes**
Expand All @@ -14,6 +14,7 @@ MontePy Changelog
**CI/CD**

* Fixed project metadata for author to show up correctly on PyPI (:pull:`408`)
* Removed automated versioning from CI/CD, and simplified deploy process (:pull:`418`)

0.2.7
-----------------------
Expand Down
26 changes: 13 additions & 13 deletions doc/source/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,22 @@ So all new features and bug fixes must first be merged onto ``develop``.
The expectation is that features once merged onto ``develop`` are stable,
well tested, well documented, and well-formatted.

Automated Versioning
^^^^^^^^^^^^^^^^^^^^
Versioning
^^^^^^^^^^

As part of the CD process a new version number is created.
The `GitHub action <https://github.com/laputansoft/github-tag-action>`_ that does this goes through the following process:
Version information is stored in git tags,
and retrieved using `setuptools scm <https://setuptools-scm.readthedocs.io/en/latest/>`_.
The version tag shall match the regular expression:

#. Finds the last release version as git tags.
#. Analyzes all commit messages since then to determine if this is a Major, Minor, or Patch release.
#. Creates a tag with the apropriately incremented new release version.
``v\d.\d+.\d+``.

This means that git commit messages needs to convey the appropriate level of information.
This convention will not be enforced for all commits,
but will be for all merge commits from Pull Requests.
These tags will be applied by a maintainer during the release process,
and cannot be applied by normal users.

MontePy follows the semantic versioning standard to the best of our abilities.

Additional References:

#. `github action <https://github.com/laputansoft/github-tag-action>`_
#. `Semantic versioning standard <https://semver.org/>`_

Merge Checklist
Expand All @@ -124,8 +123,9 @@ Deploy Checklist

For a deployment you need to:

#. Update changelog version number.
#. Tag the next version number.
#. Run the deploy script : ``.github/scripts/deploy.sh``
#. Manually merge onto main without creating a new commit.
This is necessary because there's no way to do a github PR that will not create a new commit, which will break setuptools_scm.


Package Structure
Expand Down

0 comments on commit 1df0cf5

Please sign in to comment.