Skip to content

Commit

Permalink
Update package name and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
boidolr committed Jan 22, 2022
1 parent 390259d commit a1522bd
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 66 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@ on: create
jobs:
create-release:
runs-on: ubuntu-latest
env:
GIT_USER: github-actions

steps:
- name: Create release for tag
uses: actions/github-script@v5.1.0
uses: boidolr/actions/create-release@main
if: |
startsWith(github.ref, 'refs/tags/v') &&
github.actor == 'boidolr'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const repository = context.repo
await github.rest.repos.createRelease({
owner: repository.owner,
repo: repository.repo,
tag_name: context.payload.ref,
});
tag-name: "${{ github.ref }}"
25 changes: 2 additions & 23 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,15 @@ jobs:
pre-commit-update:
runs-on: ubuntu-latest
env:
BRANCH: github-action/pre-commit
BRANCH: main

steps:
- uses: actions/checkout@v2

- uses: boidolr/actions/python-pip-env@main

- uses: actions/cache@v2.1.7
with:
path: ~/.cache/pre-commit
key: "${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}"

- name: Update pre-commit
run: |
pip install -q pre-commit
pre-commit autoupdate
pre-commit run --all-files
- uses: boidolr/actions/update-precommit@main

- name: Push pre-commit changes
id: git-push
uses: boidolr/actions/git-push@main
with:
message: "Update pre-commit config"
branch: "${{ env.BRANCH }}"

- name: Create pre-commit update pull request
uses: boidolr/actions/create-pr@main
if: >
steps.git-push.outputs.pushed-changes == 'true'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
title: "Update pre-commit config"
branch: "${{ env.BRANCH }}"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
commit_hooks.egg-info
*.egg-info
.pytest_cache
*.pyc
.mypy_cache/
Expand Down
23 changes: 7 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## https://pre-commit.com
# pre-commit install -t pre-commit -t prepare-commit-msg -t commit-msg
# pre-commit install -t pre-commit
#
# Run hooks on repo:
# pre-commit run --all-files [hook-id]
Expand All @@ -22,6 +22,11 @@ repos:
# - id: optimize-png
# - id: optimize-svg
# - id: optimize-webp
# - repo: https://github.com/boidolr/pre-commit-text
# rev: v1.0.0
# hooks:
# - id: pretty-format-yaml
# args: [--preserve-quotes]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
Expand All @@ -31,13 +36,10 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
files: \.(java|groovy|properties|ts|js|scss|yaml)$
files: \.(py|yaml)$
args: [--fix=lf]
- id: no-commit-to-branch
args: [--pattern=^release, --branch=develop]
- id: pretty-format-json
args: [--autofix, --indent=4, --no-sort-keys]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
Expand All @@ -51,12 +53,6 @@ repos:
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
hooks:
- id: prettier
types: [yaml]

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
Expand Down Expand Up @@ -89,8 +85,3 @@ repos:
hooks:
- id: bandit
args: [--configfile, .bandit.yaml]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.3
hooks:
- id: shellcheck
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ endif
release: test version
@echo "Next version: ${NEXT_VERSION}"
@sed -E -e "s/rev: v${CURRENT}/rev: v${NEXT_VERSION}/" -i '' README.md
@sed -E -e "s/version = ${CURRENT}/version = ${NEXT_VERSION}/" -i '' setup.cfg
@git add README.md setup.cfg
@sed -E -e "s/VERSION = ${CURRENT}/VERSION = ${NEXT_VERSION}/" -i '' pre_commit_images/__init__.py
@git add README.md pre_commit_images/__init__.py
git commit -m "Release version ${NEXT_VERSION}" && git tag "v${NEXT_VERSION}"


Expand Down
1 change: 0 additions & 1 deletion hooks/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions pre_commit_images/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "1.0.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": [
"config:base",
":disableDependencyDashboard"
":disableDependencyDashboard",
":automergePr",
":automergeMinor"
]
}
13 changes: 7 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pre_commit_images
version = attr: hooks.VERSION
version = attr: pre_commit_images.VERSION
description = Some image optimization hooks for pre-commit.
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down Expand Up @@ -34,11 +34,11 @@ exclude =

[options.entry_points]
console_scripts =
optimize-avif = hooks.optimize_avif:main
optimize-jpg = hooks.optimize_jpg:main
optimize-png = hooks.optimize_png:main
optimize-svg = hooks.optimize_svg:main
optimize-webp = hooks.optimize_webp:main
optimize-avif = pre_commit_images.optimize_avif:main
optimize-jpg = pre_commit_images.optimize_jpg:main
optimize-png = pre_commit_images.optimize_png:main
optimize-svg = pre_commit_images.optimize_svg:main
optimize-webp = pre_commit_images.optimize_webp:main

[options.extras_require]
tests =
Expand All @@ -62,6 +62,7 @@ filterwarnings =

[flake8]
max-line-length = 120
extend-ignore = E203

[mypy]
check_untyped_defs = True
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_avif_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
from pathlib import Path

from hooks.optimize_avif import main
from pre_commit_images.optimize_avif import main


def test_compress_avif(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_jpg_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
from pathlib import Path

from hooks.optimize_jpg import main
from pre_commit_images.optimize_jpg import main


def test_compress_jpg(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_png_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
from pathlib import Path

from hooks.optimize_png import main
from pre_commit_images.optimize_png import main


def test_compress_png(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_svg_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
from pathlib import Path

from hooks.optimize_svg import main
from pre_commit_images.optimize_svg import main


def test_compress_svg(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_webp_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
from pathlib import Path

from hooks.optimize_webp import main
from pre_commit_images.optimize_webp import main


def test_compress_webp(tmpdir):
Expand Down

0 comments on commit a1522bd

Please sign in to comment.