| 1 | name: Publish |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - '*' |
| 7 | |
| 8 | jobs: |
| 9 | publish: |
| 10 | runs-on: ubuntu-latest |
| 11 | |
| 12 | steps: |
| 13 | - uses: actions/checkout@v2 |
| 14 | |
| 15 | - name: Setup Python |
| 16 | uses: actions/setup-python@v2 |
| 17 | with: |
| 18 | python-version: '3.x' |
| 19 | |
| 20 | - name: Install Tox |
| 21 | run: pip install tox |
| 22 | |
| 23 | - name: Build and Publish |
| 24 | env: |
| 25 | TWINE_USERNAME: __token__ |
| 26 | TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 27 | run: tox -e publish |
| 28 | |
| 29 | - name: Get version number |
| 30 | id: get_version |
| 31 | run: echo ::set-output name=version::${GITHUB_REF#refs/tags/} |
| 32 | |
| 33 | - name: Create Release |
| 34 | id: create_release |
| 35 | uses: actions/create-release@v1 |
| 36 | env: |
| 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | with: |
| 39 | tag_name: ${{ github.ref }} |
| 40 | release_name: Version ${{ steps.get_version.outputs.version }} |
| 41 | body: Please refer to the CHANGELOG file for a detailed change log. |
| 42 | draft: true |
| 43 | prerelease: false |
| 44 | |
| 45 | - name: Upload Release Asset |
| 46 | id: upload_release_asset |
| 47 | uses: actions/upload-release-asset@v1 |
| 48 | env: |
| 49 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | with: |
| 51 | upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 52 | asset_path: dist/isoduration-${{ steps.get_version.outputs.version }}.tar.gz |
| 53 | asset_name: isoduration-${{ steps.get_version.outputs.version }}.tar.gz |
| 54 | asset_content_type: application/gzip |