Skip to content

Commit

Permalink
feat(ci): add gh actions worfklow files (#7)
Browse files Browse the repository at this point in the history
* feat(ci): add gh actions worfklow files

* fix(ci): try to fix detached head

* fix(ci): fix wrong branch

* fix(ci): rebase from origin

* fix(ci): add dummy git user
  • Loading branch information
alexandreteles authored Sep 13, 2024
1 parent f19d7ca commit 4c39926
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Python Package Release Test
on:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
test-release:
runs-on: ubuntu-latest
concurrency: release
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup dummy git user
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
- name: Checkout main and rebase
run: |
git checkout main
git rebase origin/${{ github.head_ref }}
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@v9.8.8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: "-vv --noop"
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python Package Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@v9.8.8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

60 changes: 59 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,62 @@ pdoc3 = "^0.11.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry.core.masonry.api"

[tool.semantic_release]
version_toml = [
"pyproject.toml:tool.poetry.version",
]
build_command = "poetry build"
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
commit_parser = "angular"
logging_use_named_masks = false
major_on_zero = true
allow_zero_version = true
no_git_verify = false
tag_format = "v{version}"

[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease_token = "rc"
prerelease = false

[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = []

[tool.semantic_release.changelog.environment]
block_start_string = "{%"
block_end_string = "%}"
variable_start_string = "{{"
variable_end_string = "}}"
comment_start_string = "{#"
comment_end_string = "#}"
trim_blocks = false
lstrip_blocks = false
newline_sequence = "\n"
keep_trailing_newline = false
extensions = []
autoescape = true

[tool.semantic_release.commit_author]
env = "GIT_COMMIT_AUTHOR"
default = "semantic-release <semantic-release>"

[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0

[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = false
insecure = false

[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
upload_to_vcs_release = true

0 comments on commit 4c39926

Please sign in to comment.