|
| 1 | +name: Create release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + changes: |
| 11 | + name: "Create changelog and tag" |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + skipped: ${{ steps.changelog.outputs.skipped }} |
| 15 | + clean_changelog: ${{ steps.changelog.outputs.clean_changelog }} |
| 16 | + tag: ${{ steps.changelog.outputs.tag }} |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + id: checkout |
| 22 | + |
| 23 | + - name: Conventional Changelog Action |
| 24 | + id: changelog |
| 25 | + uses: TriPSs/conventional-changelog-action@v3 |
| 26 | + with: |
| 27 | + github-token: ${{ secrets.github_token }} |
| 28 | + output-file: "false" |
| 29 | + skip-version-file: "true" |
| 30 | + skip-commit: "true" |
| 31 | + |
| 32 | + release: |
| 33 | + name: "Create release" |
| 34 | + needs: changes |
| 35 | + if: ${{ needs.changes.outputs.skipped == 'false' }} |
| 36 | + runs-on: ubuntu-latest |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Create Release |
| 40 | + id: release |
| 41 | + uses: actions/create-release@v1 |
| 42 | + if: ${{ steps.changelog.outputs.skipped == 'false' }} |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ secrets.github_token }} |
| 45 | + with: |
| 46 | + tag_name: ${{ needs.changes.outputs.tag }} |
| 47 | + release_name: ${{ needs.changes.outputs.tag }} |
| 48 | + body: ${{ needs.changes.outputs.clean_changelog }} |
| 49 | + |
| 50 | + publish: |
| 51 | + name: "Publish at PyPi" |
| 52 | + needs: changes |
| 53 | + if: ${{ needs.changes.outputs.skipped == 'false' }} |
| 54 | + runs-on: ubuntu-latest |
| 55 | + |
| 56 | + steps: |
| 57 | + - name: checkout |
| 58 | + uses: actions/checkout@v2 |
| 59 | + id: checkout |
| 60 | + ref: ${{ needs.changes.outputs.tag }} |
| 61 | + |
| 62 | + - name: Prepare python for publish |
| 63 | + uses: actions/setup-python@v2 |
| 64 | + with: |
| 65 | + python-version: '3.x' |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: | |
| 69 | + python -m pip install --upgrade pip |
| 70 | + pip install setuptools wheel twine |
| 71 | +
|
| 72 | + - name: Set version |
| 73 | + env: |
| 74 | + VERSION: ${{ needs.changes.outputs.tag }} |
| 75 | + run: echo "VERSION = '${VERSION##v}'" > tion_btle/const.py |
| 76 | + |
| 77 | + - name: Build |
| 78 | + run: python setup.py sdist bdist_wheel |
| 79 | + |
| 80 | + - name: Publish |
| 81 | + env: |
| 82 | + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| 83 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 84 | + run: twine upload dist/* |
0 commit comments