Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 3c72f18

Browse files
authored
Add auto-version bump (#238)
* Add auto-version bump * Add docstring * Change where version is stored * Add auto-publish and bump correct file
1 parent f18e2eb commit 3c72f18

File tree

3 files changed

+74
-35
lines changed

3 files changed

+74
-35
lines changed

.bumpversion.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[bumpversion]
2+
commit = True
3+
tag = True
4+
current_version = 0.2.1
5+
6+
[bumpversion:file:setup.py]
7+
search = version="{current_version}"
8+
replace = version="{new_version}"

.github/workflows/publish.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Bump version and auto-release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
new_tag: ${{ steps.bumper.outputs.new_ver }}
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Bump version
14+
id: bumper
15+
uses: jaumann/[email protected]
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
- name: Push changes
19+
uses: ad-m/github-push-action@master
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
tags: true
23+
24+
release:
25+
needs: [build]
26+
runs-on: ubuntu-latest
27+
steps:
28+
- run: echo ${{needs.build.outputs.new_tag}}
29+
- name: Changelog
30+
uses: scottbrenner/generate-changelog-action@master
31+
id: Changelog
32+
env:
33+
REPO: ${{ github.repository }}
34+
- name: Create Release
35+
id: create_release
36+
uses: actions/create-release@latest
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
tag_name: ${{ needs.build.outputs.new_tag }}
41+
release_name: v${{ needs.build.outputs.new_tag }}
42+
body: |
43+
${{ steps.Changelog.outputs.changelog }}
44+
draft: false
45+
prerelease: false
46+
47+
publish:
48+
needs: [release]
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
- name: Set up Python
53+
uses: actions/setup-python@v2
54+
with:
55+
python-version: "3.x"
56+
- name: Install dependencies
57+
run: |
58+
python -m pip install --upgrade pip
59+
pip install build
60+
- name: Build package
61+
run: python -m build
62+
- name: Publish package
63+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
64+
with:
65+
user: __token__
66+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)