[Automated] Version Bump from 0.4.3 to 0.5.0 #108
This file contains 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: | |
push: | |
branches: | |
- main | |
jobs: | |
bump: | |
env: | |
RELEASE_REPOSITORY: pypi | |
RELEASE_PACKAGE_NAME: emnify-sdk | |
RELEASE_PYPI_TOKEN: ${{secrets.PYPI_RELEASE_TOKEN}} | |
name: Bump and Release | |
# Prevent circular workflow run | |
if: "!contains(github.event.pusher.name, 'emnify-gha')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.EMNIFY_GITHUB_ACTIONS_TOKEN }} | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
release_branches: master,main,feature/automated-release | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
- name: Apply Bump | |
id: bump | |
run: | | |
docker build . -f Dockerfile.dev -t emnify/python-sdk | |
docker run -v $(pwd):/sdk emnify/python-sdk bump2version patch --new-version=${{ steps.tag_version.outputs.new_version }} --list >> $GITHUB_ENV | |
cat > emnify/version.py << EOT | |
# THIS FILE IS GENERATED AUTOMATICALLY, DON'T CHANGE ITS CONTENT!! | |
EMNIFY_PACKAGE_VERSION="${{ steps.tag_version.outputs.new_version }}" | |
EOT | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: '[Automated] Version Bump from ${{ env.current_version }} to ${{ env.new_version }}' | |
- name: Release and Publish Package | |
run: | | |
cat <<EOT >> .env | |
TWINE_REPOSITORY=${{env.RELEASE_REPOSITORY}} | |
TWINE_USERNAME=__token__ | |
TWINE_PASSWORD=${{env.RELEASE_PYPI_TOKEN}} | |
PYPI_PACKAGE_NAME=${{env.RELEASE_PACKAGE_NAME}} | |
EOT | |
docker run --env-file=.env -v $(pwd):/sdk emnify/python-sdk python3 -m build | |
docker run --env-file=.env -v $(pwd):/sdk emnify/python-sdk python3 -m twine upload dist/* | |