name: Release on: push: branches: - main permissions: contents: read jobs: release: permissions: contents: write pull-requests: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: cache: pip python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine bump2version git-changelog # better-exceptions(optional for debug) - name: Bump version run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' bump2version patch NEW_VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml) echo "new_version=$NEW_VERSION" >> $GITHUB_ENV echo "New version: $NEW_VERSION" - name: Push changes run: | echo "${{ secrets.PRIVATE_KEY }}" >> ~/private_key chmod 600 ~/private_key GIT_SSH_COMMAND="ssh -i ~/private_key" git push --follow-tags - name: Generate changelog run: | make changelog - name: Prepare release notes run: make release-notes > release-notes.md - name: Create GitHub release uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.new_version }} release_name: Release ${{ env.new_version }} body_path: release-notes.md prerelease: false # package: # needs: release # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 # - name: Set up Python # uses: actions/setup-python@v5 # with: # cache: pip # python-version: '3.10' # - run: env | sort # - run: make dev # - run: make build # - env: # TWINE_USERNAME: __token__ # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} # run: | # make upload