Refactor/config (#277) #100
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: Development Release | |
on: | |
push: | |
branches: | |
- 'release/*' | |
paths: | |
- 'src/**.py' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set GitHub Actions as Commit Author | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
- name: Checkout repo | |
uses: actions/checkout@main | |
with: | |
token: ${{ secrets.DJTOOLS_WORKFLOWS }} | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@main | |
with: | |
python-version: 3.9 | |
cache: 'pip' | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --editable ".[dev]" | |
- name: Bump version | |
run: | | |
NEXT_VERSION=`python -c "import semver; from djtools.version import get_version; ver = semver.Version.parse(get_version()).bump_prerelease(); print(ver)"` | |
SEMVER_REGEX="version = \"([0-9]+)\.([0-9]+)\.([0-9]+)([-]{0,1})(((b{0,1})|(rc{0,1}))[\.]{0,1}[0-9]+){0,1}\"" | |
sed -i -E "s/$SEMVER_REGEX/version = \"$NEXT_VERSION\"/g" pyproject.toml | |
- name: Build and publish wheel | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.DJTOOLS_PYPI_TOKEN }} | |
run: | | |
python -m build | |
twine upload dist/* | |
- name: Commit changes | |
run: | | |
git add pyproject.toml | |
git commit -m "Release: $GITHUB_SHA" | |
git push --force |