|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + workflow_dispatch: {} |
| 7 | + |
| 8 | +jobs: |
| 9 | + find_version: |
| 10 | + name: Find Version |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + version: ${{ steps.get-version.outputs.version }} |
| 14 | + steps: |
| 15 | + - name: Checkout source |
| 16 | + |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@v2 |
| 19 | + with: |
| 20 | + python-version: 3.7 |
| 21 | + - name: Get version |
| 22 | + id: get-version |
| 23 | + run: python -c 'import splunklib; print("::set-output name=version::%s" % splunklib.__version__)' |
| 24 | + tag_version: |
| 25 | + needs: find_version |
| 26 | + name: Tag Version |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - name: Create tag |
| 30 | + |
| 31 | + with: |
| 32 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + tag: ${{ needs.find_version.outputs.version }} |
| 34 | + release: |
| 35 | + needs: [find_version, tag_version] |
| 36 | + name: Create Release |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Checkout code |
| 40 | + |
| 41 | + - name: Create Release |
| 42 | + id: create_release |
| 43 | + uses: actions/create-release@v1 |
| 44 | + env: |
| 45 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + with: |
| 47 | + tag_name: ${{ needs.find_version.outputs.version }} |
| 48 | + release_name: Release/${{ needs.find_version.outputs.version }} |
| 49 | + body: | |
| 50 | + ## Version ${{ needs.find_version.outputs.version }} |
| 51 | +
|
| 52 | + **TODO: Insert CHANGELOG.md contents here.** |
| 53 | + draft: false |
| 54 | + prerelease: false |
| 55 | + publish: |
| 56 | + needs: release |
| 57 | + name: Deploy Release to PyPI |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout source |
| 61 | + |
| 62 | + - name: Set up Python |
| 63 | + uses: actions/setup-python@v2 |
| 64 | + with: |
| 65 | + python-version: 3.7 |
| 66 | + - name: Install dependencies |
| 67 | + run: pip install twine |
| 68 | + - name: Build package |
| 69 | + run: python setup.py sdist |
| 70 | + - name: Publish package to PyPI |
| 71 | + |
| 72 | + with: |
| 73 | + user: __token__ |
| 74 | + password: ${{ secrets.pypi_password }} |
| 75 | + # Test upload |
| 76 | + # - name: Publish package to TestPyPI |
| 77 | + # uses: pypa/gh-action-pypi-publish@master |
| 78 | + # with: |
| 79 | + # user: __token__ |
| 80 | + # password: ${{ secrets.test_pypi_password }} |
| 81 | + # repository_url: https://test.pypi.org/legacy/ |
0 commit comments