GitHub config

This commit is contained in:
Igor 2025-03-20 12:01:54 +01:00
parent 840f63d4c6
commit d2b461c927
3 changed files with 87 additions and 6 deletions

View File

@ -9,6 +9,8 @@ updates:
# Every weekday
schedule:
interval: 'daily'
day: monday
time: '06:00'
groups:
github-actions:
patterns:
@ -25,7 +27,9 @@ updates:
- 'compose/production/django/'
# Every weekday
schedule:
interval: 'daily'
interval: 'weekly'
day: monday
time: '06:00'
# Ignore minor version updates (3.10 -> 3.11) but update patch versions
ignore:
- dependency-name: '*'
@ -50,7 +54,9 @@ updates:
{%- endif %}
# Every weekday
schedule:
interval: 'daily'
interval: 'weekly'
day: monday
time: '06:00'
{%- endif %}
@ -61,7 +67,9 @@ updates:
directory: '/'
# Every weekday
schedule:
interval: 'daily'
interval: 'weekly'
day: monday
time: '06:00'
groups:
python:
update-types:

View File

@ -68,23 +68,37 @@ jobs:
uses: actions/checkout@v4
{%- if cookiecutter.use_docker == 'y' %}
- name: Dummy .env file
run: touch .env
- name: Build the Stack
run: docker compose -f docker-compose.local.yml build django
- name: Build the docs
run: docker compose -f docker-compose.docs.yml build docs
- name: Check DB Migrations
run: docker compose -f docker-compose.local.yml run --rm django python manage.py makemigrations --check
- name: Run DB Migrations
run: docker compose -f docker-compose.local.yml run --rm django python manage.py migrate
- name: Compile Translations
run: docker compose -f docker-compose.local.yml run --rm django python manage.py compilemessages
- name: Run Django Tests
run: docker compose -f docker-compose.local.yml run django pytest
- name: Tear down the Stack
run: docker compose -f docker-compose.local.yml down
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Build the docs
run: docker compose -f docker-compose.docs.yml build docs
{%- else %}
- name: Set up Python

View File

@ -0,0 +1,59 @@
name: Merge PR
on:
push:
branches: ["master", "main"]
concurrency:
group: merge_pr
cancel-in-progress: false
jobs:
bumper:
name: "Bump version number"
runs-on: ubuntu-latest
outputs:
latest_tag: {% raw %}${{ steps.latest_version.outputs.version }}{% endraw %}
bumped_tag: {% raw %}${{ steps.bumped_version.outputs.version }}{% endraw %}
steps:
- uses: actions/checkout@v4
with:
# fetch-tags: true # NOTE: Does not work [https://github.com/actions/checkout/issues/1471]
fetch-depth: 0
- name: "Get current version"
id: latest_version
shell: bash
run: |
LATEST_VERSION=$(git tag --sort=-creatordate | head -n 1)
echo "Found current version: ${LATEST_VERSION}"
echo "version=${LATEST_VERSION}" >> "$GITHUB_OUTPUT"
- name: "Bump version number"
id: bumped_version
run: |
CURRENT_VERSION="{% raw %}${{ steps.latest_version.outputs.version }}{% endraw %}"
COMMIT_MESSAGE="{% raw %}${{ github.event.head_commit.message }}{% endraw %}"
source .scripts/semver_bump.sh "$CURRENT_VERSION" "$COMMIT_MESSAGE"
- name: "Bump project version"
run: |
BUMPED_VERSION="{% raw %}${{ steps.bumped_version.outputs.version }}{% endraw %}"
# Find and replace anything that matches `__version__ = "x.x.x"`
sed -i 's/\(^__version__ = \)"[^"]*"/__version__ = "'"${BUMPED_VERSION}"'"/' gebi/__init__.py
- name: "Commit changes"
run: |
CURRENT_VERSION="{% raw %}${{ steps.latest_version.outputs.version }}{% endraw %}"
BUMPED_VERSION="{% raw %}${{ steps.bumped_version.outputs.version }}{% endraw %}"
git config --global user.name "GitHub Actions"
git config --global user.email "devops@github.com"
git add gebi/__init__.py
git commit -m "Bump version from v${CURRENT_VERSION} to v${BUMPED_VERSION}"
git push origin main
git tag ${BUMPED_VERSION}
git push origin ${BUMPED_VERSION}
echo "Bump version from v${CURRENT_VERSION} to v${BUMPED_VERSION}" >> $GITHUB_STEP_SUMMARY