| 1 |
> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
name: Release |
| 21 |
|
| 22 |
on: |
| 23 |
push: |
| 24 |
tags: |
| 25 |
- "*" |
| 26 |
workflow_dispatch: |
| 27 |
|
| 28 |
jobs: |
| 29 |
build: |
| 30 |
runs-on: ubuntu-latest |
| 31 |
|
| 32 |
steps: |
| 33 |
- name: Checkout |
| 34 |
uses: actions/checkout@v3 |
| 35 |
- name: Set up Python |
| 36 |
uses: actions/setup-python@v4 |
| 37 |
with: |
| 38 |
python-version-file: 'pyproject.toml' |
| 39 |
cache: 'pip' |
| 40 |
- name: Upgrade pip |
| 41 |
run: python3 -m pip install --upgrade pip setuptools wheel |
| 42 |
- name: Install or upgrade build |
| 43 |
run: python3 -m pip install --upgrade build |
| 44 |
|
| 45 |
- name: Build mido |
| 46 |
run: python3 -m build |
| 47 |
|
| 48 |
- uses: actions/upload-artifact@v3 |
| 49 |
with: |
| 50 |
name: mido-build |
| 51 |
path: dist/ |
| 52 |
|
| 53 |
publish-test: |
| 54 |
runs-on: ubuntu-latest |
| 55 |
needs: build |
| 56 |
steps: |
| 57 |
|
| 58 |
- uses: actions/download-artifact@v3 |
| 59 |
with: |
| 60 |
name: mido-build |
| 61 |
path: dist/ |
| 62 |
- name: Install twine |
| 63 |
run: python3 -m pip install --upgrade twine |
| 64 |
- name: Check distribution name |
| 65 |
run: twine check dist/* |
| 66 |
- name: Publish to test.pypi.org |
| 67 |
run: twine upload --repository testpypi dist/* |
| 68 |
env: |
| 69 |
TWINE_NON_INTERACTIVE: 1 |
| 70 |
TWINE_USERNAME: __token__ |
| 71 |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} |
| 72 |
- name: Test installation |
| 73 |
run: | |
| 74 |
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps mido |
| 75 |
- name: Test importing package |
| 76 |
run: python3 -c "import mido; print(mido.version_info)" |
| 77 |
|
| 78 |
publish-release: |
| 79 |
runs-on: ubuntu-latest |
| 80 |
needs: |
| 81 |
- build |
| 82 |
- publish-test |
| 83 |
steps: |
| 84 |
- uses: actions/download-artifact@v3 |
| 85 |
with: |
| 86 |
name: mido-build |
| 87 |
path: dist/ |
| 88 |
- name: Install twine |
| 89 |
run: python3 -m pip install --upgrade twine |
| 90 |
- name: Publish to pypi.org |
| 91 |
run: twine upload dist/* |
| 92 |
env: |
| 93 |
TWINE_NON_INTERACTIVE: 1 |
| 94 |
TWINE_USERNAME: __token__ |
| 95 |
TWINE_PASSWORD: ${{ secrets.PROD_PYPI_TOKEN }} |