Release #26
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| prerelease: | |
| description: "Prerelease" | |
| required: true | |
| default: false | |
| type: boolean | |
| draft: | |
| description: "Draft" | |
| required: true | |
| default: false | |
| type: boolean | |
| version-increment-type: | |
| description: 'Which part of the version to increment:' | |
| required: true | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| default: 'patch' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [ "3.12" ] | |
| steps: | |
| # Check out the repo with credentials that can bypass branch protection, and fetch git history instead of just latest commit | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
| fetch-depth: 0 | |
| - uses: DevCycleHQ/release-action/prepare-release@v2.3.0 | |
| id: prepare-release | |
| with: | |
| github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
| prerelease: ${{ github.event.inputs.prerelease }} | |
| draft: ${{ github.event.inputs.draft }} | |
| version-increment-type: ${{ github.event.inputs.version-increment-type }} | |
| - name: Update version in code | |
| run: | | |
| echo "${{steps.prepare-release.outputs.next-release-tag}}" > devcycle_python_sdk/VERSION.txt | |
| - name: Commit version change | |
| run: | | |
| git config --global user.email "github-tracker-bot@taplytics.com" | |
| git config --global user.name "DevCycle Automation" | |
| git add ./devcycle_python_sdk/VERSION.txt | |
| git commit -m "Release ${{steps.prepare-release.outputs.next-release-tag}}" | |
| - name: Push version change | |
| run: | | |
| git push origin HEAD:main | |
| if: inputs.draft != true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install twine wheel setuptools | |
| - name: Build and validate package | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| twine check dist/* | |
| - name: Upload build package to PyPI | |
| run: | | |
| twine upload --non-interactive dist/* | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| if: inputs.prerelease != true && inputs.draft != true | |
| - uses: DevCycleHQ/release-action/create-release@v2.3.0 | |
| id: create-release | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ steps.prepare-release.outputs.next-release-tag }} | |
| target: main | |
| prerelease: ${{ github.event.inputs.prerelease }} | |
| draft: ${{ github.event.inputs.draft }} | |
| changelog: ${{ steps.prepare-release.outputs.changelog }} | |
| # TODO: upload python release artifacts | |
| - name: Display link to release | |
| run: | | |
| echo "::notice title=Release ID::${{ steps.create-release.outputs.release-id }}" | |
| echo "::notice title=Release URL::${{ steps.create-release.outputs.release-url }}" |