Skip to content

Commit 6608585

Browse files
author
marci
committed
fix: bug-fixes
1 parent 8a11256 commit 6608585

File tree

3 files changed

+52
-24
lines changed

3 files changed

+52
-24
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ env:
1818
jobs:
1919
# Test-Job für verschiedene Python-Versionen
2020
test:
21-
needs: purge-caches
2221
runs-on: ubuntu-latest
2322
strategy:
2423
matrix:
@@ -74,20 +73,6 @@ jobs:
7473
file: ./coverage.xml
7574
fail_ci_if_error: false
7675

77-
# Purge-Cache-Job
78-
purge-caches:
79-
runs-on: ubuntu-latest
80-
permissions:
81-
actions: write
82-
steps:
83-
- name: Delete Actions cache for this ref
84-
continue-on-error: true
85-
run: |
86-
curl -fsSL -X DELETE \
87-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
88-
-H "Accept: application/vnd.github+json" \
89-
"https://api.github.com/repos/${{ github.repository }}/actions/caches?ref=${{ github.ref }}"
90-
9176
# Build-Job für Package-Erstellung
9277
build:
9378
runs-on: ubuntu-latest
@@ -235,7 +220,6 @@ jobs:
235220
# Security-Scan
236221
security:
237222
name: Security Scan
238-
needs: purge-caches
239223
runs-on: ubuntu-latest
240224

241225
steps:
@@ -367,7 +351,7 @@ jobs:
367351
TWINE_USERNAME: __token__
368352
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
369353
run: |
370-
python -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
354+
python -m twine upload --repository-url https://upload.pypi.org/legacy/ --skip-existing dist/*
371355
372356
- name: Create GitHub Release (Fallback)
373357
if: success()
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Cleanup Old Caches
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * SUN' # Run every Sunday at 2 AM UTC
6+
workflow_dispatch: {} # Allow manual trigger
7+
8+
permissions:
9+
actions: write
10+
11+
jobs:
12+
cleanup-caches:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Delete caches older than 7 days
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
run: |
19+
echo "Fetching repository caches..."
20+
# The API is limited to 100 results per page, --paginate handles this.
21+
# We filter for caches older than 7 days (604800 seconds) and extract their IDs.
22+
cache_ids_to_delete=$(gh api --paginate "repos/${{ github.repository }}/actions/caches" | \
23+
jq '.actions_caches[] | select((.created_at | fromdate) < (now - 604800)) | .id')
24+
25+
if [ -z "$cache_ids_to_delete" ]; then
26+
echo "No caches older than 7 days found."
27+
exit 0
28+
fi
29+
30+
echo "Found old caches to delete. IDs:"
31+
echo "$cache_ids_to_delete"
32+
33+
# Delete each cache by its ID
34+
echo "$cache_ids_to_delete" | while read -r cache_id; do
35+
echo "Deleting cache with ID: ${cache_id}"
36+
gh api "repos/${{ github.repository }}/actions/caches/${cache_id}" -X DELETE
37+
sleep 0.2 # Small delay to avoid hitting API rate limits
38+
done
39+
40+
echo "Cache cleanup finished."

pyproject.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "wheel"]
2+
requires = ["setuptools>=42", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -83,13 +83,17 @@ exclude_lines = [
8383
]
8484

8585
[tool.semantic_release]
86-
version_toml = ["pyproject.toml:project.version"]
87-
upload_to_release = true
88-
upload_to_pypi = false
86+
version_variable = "VERSION"
8987
branch = "main"
90-
changelog_file = "CHANGELOG.md"
88+
upload_to_pypi = true
89+
upload_to_release = true
9190
build_command = "pip install build && python -m build"
92-
major_on_zero = false
91+
commit_message = "chore(release): {version}\n\n[skip ci]"
92+
commit_author = "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
9393
tag_format = "v{version}"
94-
commit_parser = "conventional"
94+
95+
[tool.semantic_release.commit_parser_options]
96+
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
97+
minor_tags = ["feat"]
98+
patch_tags = ["fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"]
9599

0 commit comments

Comments
 (0)