Merge pull request #401 from idaholab/develop #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: [main] | |
jobs: | |
last-minute-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python 3.8 | |
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 | |
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 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- run: pip install --user . montepy[doc] | |
- run: cd doc && make html | |
- uses: actions/configure-pages@v4 | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
name: deploy-pages | |
path: doc/build/html/ | |
build-packages: | |
name: Build, sign, and release packages on github | |
runs-on: ubuntu-latest | |
needs: [last-minute-test] | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
id-token: write # IMPORTANT: mandatory for sigstore | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: set up python 3.8 | |
uses: actions/setup-python@v5 | |
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 | |
- run: python -m build . | |
- name: Sign the dists with Sigstore | |
uses: sigstore/[email protected] | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- 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 }} | |
draft: true | |
- run: >- | |
gh release upload | |
'${{ steps.tag_version.outputs.new_tag }}' dist/** | |
--repo '${{ github.repository }}' | |
- uses: actions/[email protected] | |
with: | |
name: build | |
path: | | |
dist/*.tar.gz | |
dist/*.whl | |
deploy-pages: | |
permissions: | |
contents: read | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: [build-pages, last-minute-test] | |
runs-on: ubuntu-latest | |
steps: | |
- run: ls -l | |
- uses: actions/download-artifact@v4 | |
with: | |
name: deploy-pages | |
- run: ls -l | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: deploy-pages | |
deploy-test-pypi: | |
environment: | |
name: test-pypi | |
url: https://test.pypi.org/p/montepy # Replace <package-name> with your PyPI project name | |
needs: [deploy-pages, build-packages] | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
deploy-pypi: | |
environment: | |
name: pypi | |
url: https://pypi.org/p/montepy # Replace <package-name> with your PyPI project name | |
needs: [deploy-pages, deploy-test-pypi, build-packages] | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |