|
| 1 | + |
| 2 | +name: Release |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - '*.*.*' |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + ######################## |
| 12 | + # RELEASE CREATION JOB # |
| 13 | + ######################## |
| 14 | + job_release: |
| 15 | + name: Create Release |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 19 | + tag: ${{ steps.tag.outputs.tag }} |
| 20 | + steps: |
| 21 | + - name: Get tag |
| 22 | + id: tag |
| 23 | + run: | |
| 24 | + echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
| 25 | + - uses: actions/checkout@v2 |
| 26 | + - name: Create Release |
| 27 | + id: create_release |
| 28 | + uses: actions/create-release@v1 |
| 29 | + env: |
| 30 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + with: |
| 32 | + tag_name: ${{ steps.tag.outputs.tag }} |
| 33 | + release_name: pnoise ${{ steps.tag.outputs.tag }} |
| 34 | + draft: true |
| 35 | + prerelease: false |
| 36 | + |
| 37 | + |
| 38 | + ################## |
| 39 | + # UPLOAD TO PYPI # |
| 40 | + ################## |
| 41 | + job_pypi: |
| 42 | + name: Upload to PyPI |
| 43 | + runs-on: ubuntu-latest |
| 44 | + needs: job_release |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v2 |
| 47 | + - name: Set up Python 3.9 |
| 48 | + uses: actions/setup-python@v2 |
| 49 | + with: |
| 50 | + python-version: 3.9 |
| 51 | + - name: Build |
| 52 | + id: build |
| 53 | + run: | |
| 54 | + pip install -r dev-requirements.txt |
| 55 | + pip install . |
| 56 | + python setup.py sdist bdist_wheel |
| 57 | + echo ::set-output name=version::`python -c "import pnoise;print(pnoise.__version__)"` |
| 58 | + - name: Upload File Assets |
| 59 | + |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + with: |
| 63 | + upload_url: ${{ needs.job_release.outputs.upload_url }} |
| 64 | + asset_path: dist/pnoise-${{ steps.build.outputs.version }}.tar.gz |
| 65 | + asset_name: pnoise-${{ steps.build.outputs.version }}.tar.gz |
| 66 | + asset_content_type: application/gzip |
| 67 | + - name: pypi-publish |
| 68 | + |
| 69 | + with: |
| 70 | + # repository_url: https://test.pypi.org/legacy/ |
| 71 | + password: ${{ secrets.PYPI_TOKEN }} |
| 72 | + # skip_existing: true |
| 73 | + verbose: true |
0 commit comments