Skip to content

Commit

Permalink
chore: update repo with recommended release files
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Peterka committed Feb 7, 2024
1 parent cf9f3ff commit 1d60322
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .editorconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
charset = utf-8
indent_style = space
indent_size = 4
max_line_length = 100
43 changes: 43 additions & 0 deletions .github/workflows/release-python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "[auto] release-python"

on:
push:
tags:
- v*

env:
PYTHON_VERSION: "3.10"

jobs:
build:
name: Release new version to PyPI
runs-on: ubuntu-latest
steps:
- name: Check version format vMAJOR.MINOR.PATCH(-SUFFIX)
run: |
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$ ]]; then
echo "Invalid version format. Expected vMAJOR.MINOR.PATCH(-SUFFIX)?, got ${GITHUB_REF_NAME}"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v4

- name: Install the project
uses: dronetag/actions/release-python@main
with:
pypi_name: dronetag
pypi_host: ${{ secrets.PRIV_PIP_HOST }}
pypi_user: ${{ secrets.PRIV_PIP_USER }}
pypi_pass: ${{ secrets.PRIV_PIP_PASSWORD }}
version: "${GITHUB_REF_NAME#v}"

- name: Commit version on release branch
run: |
if [[ $(git rev-parse heads/main) = $(git rev-parse ${GITHUB_REF}) ]]; then
echo "We are at the top of main branch so we can commit the version bump"
git checkout main
git add pyproject.toml
git commit -m "Release ${GITHUB_REF_NAME#v} [skip ci]"
git push
fi
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "RELEASE"

on:
workflow_dispatch:

jobs:
release:
name: Create release tag
runs-on: ubuntu-latest
steps:
- name: Checkout repository (full-depth)
uses: actions/checkout@v4
with: { fetch-depth: 0 } # Required to determine version

- name: Get next release version
uses: dronetag/actions/get-next-version@main
id: get-next-version

- name: Create the tag
run: |
ls -al # just for testing the changelog artifact
git config --local user.email "" && git config --local user.name "GitHub Action"
git tag -a "v${{ steps.get-next-version.outputs.version }}" -m "${{ steps.get-next-version.outputs.changelog }}"
git push origin "v${{ steps.get-next-version.outputs.version }}"
23 changes: 22 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,50 @@ repos:
entry: ruff
language: system
types: [python]
stages: [pre-commit]

- id: ruff-format
name: ruff format
entry: ruff format --diff
language: system
types: [python]
stages: [pre-commit]

- id: mypy
name: mypy
entry: mypy --exclude tests --ignore-missing-imports --follow-imports=skip --pretty
entry: mypy --exclude tests --pretty
language: system
types: [python]
stages: [pre-commit]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
stages: [pre-commit]
- id: check-docstring-first
stages: [pre-commit]
- id: check-added-large-files
stages: [pre-commit]
- id: detect-aws-credentials
stages: [pre-commit]
- id: detect-private-key
stages: [pre-commit]
- id: check-json
stages: [pre-commit]
- id: check-toml
stages: [pre-commit]
- id: check-yaml
stages: [pre-commit]
- id: debug-statements
stages: [pre-commit]
- id: check-merge-conflict
stages: [pre-commit]
- id: mixed-line-ending
args: [--fix=lf]
stages: [pre-commit]
- id: end-of-file-fixer
stages: [pre-commit]

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
Expand Down
18 changes: 18 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"branches": [
{ "name": "main" },
{ "name": "[a-z]+/([a-zA-Z0-9\\-]+)", "prerelease": "${name.replace(/^.*\\//g, '')}"}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{ "type": "refactor", "release": "patch"},
{ "type": "perf", "release": "patch" }
]
}
],
"@semantic-release/release-notes-generator"
]
}

0 comments on commit 1d60322

Please sign in to comment.