-
Notifications
You must be signed in to change notification settings - Fork 153
Update package build and deploy #4289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8c3c6e1
Update build and deploy
bouweandela 462bd75
Enable action for this branch
bouweandela 685702a
Fix typo
bouweandela b41ade6
Rerun CI
bouweandela d85af02
Verbose logging
bouweandela cd548a1
Remove some empty lines
bouweandela 0c8fa7a
Use released version of publish action
bouweandela c7e1d27
Remove publication to test pypi
bouweandela fc9bec9
Update docs
bouweandela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,61 @@ | ||
| --- | ||
| name: PyPi Build and Deploy 🐍📦 | ||
| # Workflow from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
| name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| # use this for testing | ||
| push: | ||
| # Use this for testing the package build. | ||
| branches: | ||
| - main | ||
| - v[0-9]+.[0-9]+.x # matches release branches like v2.12.x | ||
|
|
||
| jobs: | ||
| build-n-publish: | ||
| name: Build and publish ESMValTool on PyPi | ||
| build: | ||
| name: Build distribution 📦 | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/ESMValTool/ | ||
| permissions: | ||
| # IMPORTANT: this permission is mandatory for trusted publishing | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Python 3.13 | ||
| persist-credentials: false | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install pep517 | ||
| python-version: "3.x" | ||
| - name: Install pypa/build | ||
| run: >- | ||
| python -m | ||
| python3 -m | ||
| pip install | ||
| pep517 | ||
| build | ||
| --user | ||
| - name: Build a binary wheel and a source tarball | ||
| run: >- | ||
| python -m | ||
| pep517.build | ||
| --source | ||
| --binary | ||
| --out-dir dist/ | ||
| . | ||
| # - name: Publish distribution to Test PyPI | ||
| # uses: pypa/gh-action-pypi-publish@v1.13.0 | ||
| # with: | ||
| # repository-url: https://test.pypi.org/legacy/ | ||
| run: python3 -m build | ||
| - name: Store the distribution packages | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
|
|
||
| publish-to-pypi: | ||
| name: >- | ||
| Publish Python 🐍 distribution 📦 to PyPI | ||
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
| needs: | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/ESMValTool | ||
| permissions: | ||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
|
||
| steps: | ||
| - name: Download all the dists | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
| - name: Publish distribution 📦 to PyPI | ||
| if: startsWith(github.ref, 'refs/tags') | ||
| uses: pypa/gh-action-pypi-publish@v1.13.0 | ||
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this for? That'll run on our mega latest v2.9.x from three years ago 😁
On a serious note, where's that manual approval enabled/configured, in the PyPI project settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but only if you would push a commit to it.
https://github.com/ESMValGroup/ESMValTool/settings/environments/8132850576/edit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah thanks, I also reckon that's a good idea 🍺