Increment Version and Push #7
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: Bump version | |
on: | |
workflow_dispatch: | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Bump version | |
id: bump_version | |
run: | | |
VERSION=$(python -c "import toml; pyproject = toml.load('pyproject.toml'); version = pyproject['tool']['poetry']['version'].split('.'); version[2] = str(int(version[2]) + 1); print('.'.join(version))") | |
echo "New version: $VERSION" | |
sed -i "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml | |
echo "::set-output name=VERSION::$VERSION" | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add pyproject.toml | |
git commit -m "Bump version to ${{ steps.bump_version.outputs.VERSION }}" | |
git push origin main |