-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): add
create-release-pr
workflow (#26)
- Loading branch information
Showing
6 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Create release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version | ||
required: true | ||
|
||
jobs: | ||
create-pull-request: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: dev | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11.3 | ||
- name: Install Poetry | ||
uses: abatilo/actions-poetry@v2 | ||
with: | ||
poetry-version: 1.7.1 | ||
- name: Install base dependencies | ||
run: poetry install --sync --only base | ||
- name: Bump version and changelog | ||
run: poetry run invoke release.install release.build -- -v ${{ github.event.inputs.version }} | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v5.0.2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Bump version and CHANGELOG.md | ||
title: "release: v${{ github.event.inputs.version }}" | ||
body: > | ||
This PR is auto-generated by | ||
[create-pull-request](https://github.com/peter-evans/create-pull-request). | ||
branch: release/${{ github.event.inputs.version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (c) 2023-2025 Feud Developers. | ||
# Distributed under the terms of the MIT License (see the LICENSE file). | ||
# SPDX-License-Identifier: MIT | ||
# This source code is part of the Feud project (https://feud.wiki). | ||
|
||
"""Tasks for bumping the package version and updating CHANGELOG.md.""" | ||
|
||
import os | ||
import re | ||
from pathlib import Path | ||
|
||
from invoke.config import Config | ||
from invoke.tasks import task | ||
|
||
|
||
@task | ||
def install(c: Config) -> None: | ||
"""Install package with core and release dependencies.""" | ||
c.run("poetry install --sync --only base,release") | ||
|
||
|
||
@task | ||
def build(c: Config, *, v: str) -> None: | ||
"""Build release.""" | ||
root: Path = Path(os.getcwd()) | ||
|
||
# bump Sphinx documentation version - docs/source/conf.py | ||
conf_path: Path = root / "docs" / "source" / "conf.py" | ||
with open(conf_path) as f: | ||
conf: str = f.read() | ||
with open(conf_path, "w") as f: | ||
f.write(re.sub(r'release = ".*"', f'release = "{v}"', conf)) | ||
|
||
# bump package version - feud/__init__.py) | ||
init_path: Path = root / "feud" / "__init__.py" | ||
with open(init_path) as f: | ||
init: str = f.read() | ||
with open(init_path, "w") as f: | ||
f.write(re.sub(r'__version__ = ".*"', f'__version__ = "{v}"', init)) | ||
|
||
# bump project version - pyproject.toml | ||
c.run(f"poetry version {v}") | ||
|
||
# auto-generate CHANGELOG.md entry | ||
c.run("poetry run auto-changelog -- --tag-prefix v --github") |
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
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