From ce525665737470f4f5a0c16da27f0accbb8758b2 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sat, 9 Mar 2024 15:36:10 -0600 Subject: [PATCH] Update github actions to update changelog automatically. (#389) * Created test to see if changelog version can be bumped. * Gave version bump permissions. * Gave version system access to full git history. * Created changelog update version github action * Create CODE_OF_CONDUCT.md * Made shell of community documents. * Made draft contribution guide. * Started bare changelog. * Made changelog test. * Added changelog from previous releases * Fixed RST syntax. * Made stub page for scope. * Made montepy scope and moved design philosophy. * Made a better landing page, and made the table of contents more nested. * Fixed section heading error. * Made clear stance on output files. * Messed with API TOC to make it actually legible. * Updated doc test to avoid more undocumented files. * Fix artifact path. * Removed deprecated setup python api calls * Fixed deprecated use of setup python. * Removed deprecated upload artifacts. * removed deprecated upload artifacts and test reporter * removed straggler deprecated upload artifact. * Actually provided full git history to version bump. * Only upload one build artifact. * Updated workflow to have pages after package and to update changelog. * Update Changelog version to 0.2.7 * Revert "Update Changelog version to 0.2.7" This reverts commit f7bf9826c115ab56f1da4b3784d3eae4442595c8. * Make sure building pages gets the latest version that was just comitted. * Update Changelog version to 0.2.8 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/deploy.yml | 26 ++++++++++++++++++++++---- .github/workflows/main.yml | 36 +++++++++++++++++++++++++----------- doc/source/changelog.rst | 1 - 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c4fc82f8..5dbbc1bf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,13 +11,14 @@ jobs: steps: - uses: actions/checkout@v4 - name: set up python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.8 - run: pip install . montepy[develop] - run: python -m pytest build-pages: + needs: [last-minute-test, build-packages] environment: name: github-pages runs-on: ubuntu-latest @@ -27,7 +28,9 @@ jobs: TOKEN: ${{ secrets.ACCESS_TOKEN }} run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + with: + ref: main + - uses: actions/setup-python@v5 with: python-version: 3.8 - run: pip install --user . montepy[doc] @@ -53,10 +56,25 @@ jobs: fetch-depth: 0 fetch-tags: true - name: set up python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.8 - run: pip install . montepy[build] + - uses: mathieudutour/github-tag-action@v6.1 + 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/add-commit-push@v1.0.0 + 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/github-tag-action@v6.1 @@ -85,7 +103,7 @@ jobs: gh release upload '${{ steps.tag_version.outputs.new_tag }}' dist/** --repo '${{ github.repository }}' - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v4.3.1 with: name: build path: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e32d3575..587056b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - run: pip install --upgrade pip build @@ -35,7 +35,8 @@ jobs: - run: pip install --user . montepy[develop] - run: pip freeze - name: Upload build artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 + if: ${{ matrix.python-version == '3.9' }} with: name: build path: dist/* @@ -50,7 +51,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - run: pip install --user . montepy[test] @@ -59,19 +60,19 @@ jobs: - run: coverage xml - name: Upload test report if: ${{ matrix.python-version == '3.9' }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4.3.1 with: name: test path: test_report.xml - name: Upload coverage report if: ${{ matrix.python-version == '3.9' }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4.3.1 with: name: coverage path: coverage.xml - name: Test Reporter if: ${{ matrix.python-version == '3.9' }} - uses: dorny/test-reporter@v1.7.0 + uses: dorny/test-reporter@v1.8.0 with: name: CI-test-report path: test_report.xml @@ -88,17 +89,30 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: set up python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.8 - run: pip install . montepy[doc] + - uses: mathieudutour/github-tag-action@v6.1 + name: Get next version number + 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 - run: sphinx-build doc/source/ doc/build/ -W --keep-going -E - - run: sphinx-build -b html doc/source/ doc/build/html - - uses: actions/upload-artifact@v3 + name: Build site strictly + - uses: actions/upload-artifact@v4.3.1 with: name: website - path: doc/build/html + path: doc/build - name: Test for missing API documentation run: | cd doc/source @@ -110,7 +124,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: set up python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.8 - run: pip install . montepy[format] diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 80448f84..9ed36f32 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -1,7 +1,6 @@ MontePy Changelog ================= - #Next Version# -----------------------