-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from MetOffice/packaging
Package on PyPI.
- Loading branch information
Showing
5 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Publish packages | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
# Allow only one concurrent deployment | ||
concurrency: | ||
group: "release" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build-package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: python3 -m pip install tox tox-conda | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
key: tox|build-package|${{ runner.os }}-${{ runner.arch}}|${{ hashFiles('requirements/locks/*') }} | ||
path: .tox | ||
|
||
- name: Build package | ||
run: tox -e build-package | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: packages | ||
path: dist/ | ||
retention-days: 10 | ||
if-no-files-found: error | ||
|
||
pypi-publish: | ||
name: Publish to PyPI | ||
runs-on: ubuntu-latest | ||
needs: build-package | ||
environment: | ||
name: release | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: packages | ||
path: dist/ | ||
|
||
# External actions are disabled via organization policies therefore we | ||
# must instead manually implement it. | ||
# https://docs.pypi.org/trusted-publishers/using-a-publisher/#the-manual-way | ||
# - name: Publish package distributions to PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: python -m pip install twine | ||
|
||
- name: Check package metadata | ||
run: python -m twine check --strict dist/* | ||
|
||
- name: Upload to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: python3 -m twine upload --disable-progress-bar --verbose --non-interactive dist/* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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